diff options
Diffstat (limited to 'server/handlers.py')
-rw-r--r-- | server/handlers.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/server/handlers.py b/server/handlers.py index 30f52f1..da257c1 100644 --- a/server/handlers.py +++ b/server/handlers.py @@ -303,14 +303,20 @@ class SamlLogin(CodeqService): js = request.data saml_data = js.get('saml_data') gui_lang = js.get('gui_lang', 'en') + upgrade_account = js.get('upgrade_account') + upgrade_password = js.get('upgrade_password') if saml_data is None: - request.reply({'code': 1, 'message': 'SAML user data not specified'}) + request.reply({'code': 3, 'message': 'SAML user data not specified'}) else: session = request.session try: - name, email, date_joined, last_login = session.saml_login_or_signup(saml_data, gui_lang) - except Exception as e: - request.reply({'code': 2, 'message': 'SAML login failed: ' + str(e)}) + name, email, date_joined, last_login = session.saml_login_or_signup(saml_data, gui_lang, upgrade_account, upgrade_password) + except AccountMergeRequired as amr: + request.reply({'code': 1, 'message': 'Retry with "upgrade_account" and "upgrade_password"', 'username': amr.username}) + except AuthenticationFailed as af: + request.reply({'code': 4, 'message': 'Password is incorrect'}) +# except Exception as e: +# request.reply({'code': 2, 'message': 'SAML login failed: ' + str(e)}) else: request.reply({'code': 0, 'message': 'OK', 'name': name, 'email': email, 'joined': date_joined.isoformat(), 'last-login': last_login.isoformat(), 'settings': session.get_settings()}) |