def login():
    '''
    Render home page
    '''
       if request.method == 'POST':
            name = request.get_json()['name']
            return get_user(name)
        return render_template('login.html')
Пример #2
0
def to_do(name):
    '''
    Route to get the tasks and post a task

    :param name: of the user
    '''
    user = get_user(name)
    if request.method == 'POST':
        return save_task(user, dict(request.get_json()))
    if request.method == 'GET':
        return render_template('to_do.html', user=user)
Пример #3
0
def user_info_get():
    email = session['email']
    if email is None:
        return returns(1, {}, '未登录或登陆过期')
    one = get_user(email)
    user_info = {
        "username": one.username,
        "email": one.email,
        "imageUrl": one.imageUrl,
        "birthday": one.birthday
    }
    return returns(0, user_info, '成功!')
Пример #4
0
def task(name, task_id):
    '''
    Route to update or delete a task

    :param name: of the user

    :param task_id: of the task
    '''
    user = get_user(name)
    if request.method == 'DELETE':
        return delete_task(user, task_id)
    if request.method == 'PATCH':
        return check_task(user, task_id)
Пример #5
0
def resolve_get_user(*_, id):
    return get_user(id)
Пример #6
0
def resolve_user(post_obj, info):
    user_id = post_obj['user_id']
    return get_user(user_id)
Пример #7
0
def get_user_details():
    '''Get user details'''
    username = request.args.get("username")
    details = get_user(username)
    return json.dumps(details)
Пример #8
0
def get_user_details():
    '''Retrieves user details'''
    username = request.args.get("username")
    user = get_user(username)
    return json.dumps(user)