# Path: wikked/web.py
# def get_wiki():
# def uncaching_wiki_updater(wiki, url):
# def user_loader(username):
# def get_read_url(url):
# def get_edit_url(url):
# def get_rev_url(url, rev):
# def get_diff_url(url, rev1=None, rev2=None):
#     def async_updater(wiki):
#     def on_request_started(sender, **extra):
#     def on_request_tearing_down(sender, **extra):
# 
# Path: wikked/webimpl/admin.py
# def do_login_user():
#     username = request.form.get('username')
#     password = request.form.get('password')
#     remember = request.form.get('remember')
# 
#     wiki = get_wiki()
#     user = wiki.auth.getUser(username)
#     if user is not None and app.bcrypt:
#         if app.bcrypt.check_password_hash(user.password, password):
#             login_user(user, remember=bool(remember))
#             return True
#     return False


from flask import jsonify, abort, request
from flask_login import logout_user, current_user
from wikked.web import app, get_wiki
from wikked.webimpl.admin import do_login_user
        result = {'logged_in': True}
        return jsonify(result)
    abort(401)


@app.route('/api/user/logout', methods=['POST'])
def api_user_logout():
    logout_user()
    result = {'ok': 1}
    return jsonify(result)


@app.route('/api/user/info')
def api_current_user_info():
    user = current_user
    if user.is_authenticated():
        result = {
            'user': {
                'username': user.username,
                'groups': user.groups
            }
        }
        return jsonify(result)
    return jsonify({'user': False})


@app.route('/api/user/info/<name>')
def api_user_info(name):
    wiki = get_wiki()
    user = wiki.auth.getUser(name)

# Path: wikked/web.py
# def get_wiki():
# def uncaching_wiki_updater(wiki, url):
# def user_loader(username):
# def get_read_url(url):
# def get_edit_url(url):
# def get_rev_url(url, rev):
# def get_diff_url(url, rev1=None, rev2=None):
#     def async_updater(wiki):
#     def on_request_started(sender, **extra):
#     def on_request_tearing_down(sender, **extra):
# 
# Path: wikked/webimpl/admin.py
# def do_login_user():
#     username = request.form.get('username')
#     password = request.form.get('password')
#     remember = request.form.get('remember')
# 
#     wiki = get_wiki()
#     user = wiki.auth.getUser(username)
#     if user is not None and app.bcrypt:
#         if app.bcrypt.check_password_hash(user.password, password):
#             login_user(user, remember=bool(remember))
#             return True
#     return False


# Path: wikked/api/user.py
from flask import jsonify, abort, request
from flask_login import logout_user, current_user
from wikked.web import app, get_wiki
from wikked.webimpl.admin import do_login_user

        result = {'logged_in': True}
        return jsonify(result)
    abort(401)


@app.route('/api/user/logout', methods=['POST'])
def api_user_logout():
    logout_user()
    result = {'ok': 1}
    return jsonify(result)


@app.route('/api/user/info')
def api_current_user_info():
    user = current_user
    if user.is_authenticated():
        result = {
            'user': {
                'username': user.username,
                'groups': user.groups
            }
        }
        return jsonify(result)
    return jsonify({'user': False})


@app.route('/api/user/info/<name>')
def api_user_info(name):
    wiki = get_wiki()
    user = wiki.auth.getUser(name)

    if user is not None: