def login():
    '''
    Render home page
    '''
       if request.method == 'POST':
            name = request.get_json()['name']
            return get_user(name)
        return render_template('login.html')
Exemple #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)
Exemple #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, '成功!')
Exemple #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)
Exemple #5
0
def resolve_get_user(*_, id):
    return get_user(id)
Exemple #6
0
def resolve_user(post_obj, info):
    user_id = post_obj['user_id']
    return get_user(user_id)
Exemple #7
0
def get_user_details():
    '''Get user details'''
    username = request.args.get("username")
    details = get_user(username)
    return json.dumps(details)
Exemple #8
0
def get_user_details():
    '''Retrieves user details'''
    username = request.args.get("username")
    user = get_user(username)
    return json.dumps(user)