Ejemplo n.º 1
0
def password_reset():
    json_dict = request.json
    email = json_dict['email']
    user = User.get_user_by_email(email)
    if not user:
        return Responses.NOT_EXIST()

    user.send_password_reset_email(email)
Ejemplo n.º 2
0
def update_user_information(email):
    """
    updates user by using email

    Args:
        email (string): 

    Returns:
        (string,int): user info if update succesful, otherwise response no need to update
    """
    user = User.get_user_by_email(email)
    if not user:
        return Responses.NOT_EXIST()
    if not user.email_confirmed:
        return Responses.UNCONFIRMED_USER()

    json_dict = request.json
    if len(user.update(json_dict)) > 0:  #['password']
        return Responses.OPERATION_FAILED()
    return Responses.SUCCESS()