Make our registry respond with their silly response message that will make login work without saying account created every time.

This commit is contained in:
jakedt 2014-02-20 14:49:34 -05:00
parent 57dc1e045a
commit 05dd00d495

View file

@ -67,19 +67,24 @@ def create_user():
username = user_data['username']
password = user_data['password']
# UGH! we have to use this response when the login actually worked, in order
# to get the CLI to try again with a get, and then tell us login succeeded.
success = make_response('"Username or email already exists"', 400)
if username == '$token':
try:
model.load_token_data(password)
return make_response('Verified', 201)
return success
except model.InvalidTokenException:
abort(400, 'Invalid access token.', issue='invalid-access-token')
elif '+' in username:
try:
model.verify_robot(username, password)
return make_response('Verified', 201)
return success
except model.InvalidRobotException:
abort(400, 'Invalid robot account or password.', issue='robot-login-failure')
abort(400, 'Invalid robot account or password.',
issue='robot-login-failure')
existing_user = model.get_user(username)
if existing_user:
@ -89,7 +94,7 @@ def create_user():
event = app.config['USER_EVENTS'].get_event(username)
event.publish_event_data('docker-cli', {'action': 'login'})
return make_response('Verified', 201)
return success
else:
# Mark that the login failed.
event = app.config['USER_EVENTS'].get_event(username)