From 05dd00d4952ef9cd97d88d30feada4b1a1eaf16a Mon Sep 17 00:00:00 2001 From: jakedt Date: Thu, 20 Feb 2014 14:49:34 -0500 Subject: [PATCH] Make our registry respond with their silly response message that will make login work without saying account created every time. --- endpoints/index.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/endpoints/index.py b/endpoints/index.py index 4af671849..73ced37db 100644 --- a/endpoints/index.py +++ b/endpoints/index.py @@ -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)