Esempio n. 1
0
def password_update():
    json_dict = request.json
    user = User.get_user_by_email(json_dict['email'])

    error = user.update(json_dict['password'])

    if len(error) > 0:
        return Responses.OPERATION_FAILED()
    else:
        return Responses.SUCCESS()
Esempio n. 2
0
def contact_us():
    json_dict = request.json
    email = json_dict['email']
    subject = json_dict['subject']
    name = json_dict['name']
    message = json_dict['message']

    User.contact_us_email(email, subject, name, message)

    return Responses.SUCCESS()
Esempio n. 3
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()