Make it so that our error responses to login attempts are legible to the user.

This commit is contained in:
yackob03 2014-01-10 13:11:41 -05:00
parent 7f4a66be99
commit 1f8a82eefe

View file

@ -63,14 +63,14 @@ def create_user():
model.load_token_data(password)
return make_response('Verified', 201)
except model.InvalidTokenException:
abort(401)
return make_response('Invalid access token.', 400)
elif '+' in username:
try:
model.verify_robot(username, password)
return make_response('Verified', 201)
except model.InvalidRobotException:
abort(401)
return make_response('Invalid robot account or password.', 400)
existing_user = model.get_user(username)
if existing_user:
@ -78,7 +78,7 @@ def create_user():
if verified:
return make_response('Verified', 201)
else:
abort(401)
return make_response('Invalid password.', 400)
else:
# New user case
new_user = model.create_user(username, password, user_data['email'])