Exemplo n.º 1
0
def validate_user():
    username = request.args.get("username")
    if username:
        valid, message = registration_logic.check_username(username)
        return json_success(valid=valid, message=message)

    email = request.args.get("email")
    if email:
        valid, message = registration_logic.check_email(email)
        return json_success(valid=valid, message=message)

    return json_failure(message=error_messages.argument_missing)
Exemplo n.º 2
0
def validate_user():
    username = request.args.get("username")
    if username:
        valid, message = registration_logic.check_username(username)
        return json_success(valid=valid,
                            message=message)

    email = request.args.get("email")
    if email:
        valid, message = registration_logic.check_email(email)
        return json_success(valid=valid, message=message)

    return json_failure(message=error_messages.argument_missing)
Exemplo n.º 3
0
 def validate_email(self, field):
     valid, message = registration_logic.check_email(field.data)
     if not valid:
         raise validators.ValidationError(message)