示例#1
0
def login(email, password):
    errors = {}

    user = get_user_by_email(email)

    if not user or not user.enabled:
        errors["email"] = get_response_error("WRONG_EMAIL")
    if errors:
        return False, None, errors

    return execute_login(user, password)
示例#2
0
def register(email, password):
    errors = {}

    user = get_user_by_email(email)

    if user:
        errors["email"] = get_response_error("EMAIL_ALREADY_REGISTERED")
    if errors:
        return False, None, errors

    return execute_register(email, password)