From 01ca381c3a5bd07d01ee308f1edf740af232239e Mon Sep 17 00:00:00 2001 From: Juleen Graham Date: Tue, 8 Sep 2020 04:28:40 -0400 Subject: [PATCH 1/3] display proper clientside error --- lib/galaxy/authnz/custos_authnz.py | 2 +- lib/galaxy/authnz/managers.py | 3 +-- lib/galaxy/webapps/galaxy/controllers/authnz.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/authnz/custos_authnz.py b/lib/galaxy/authnz/custos_authnz.py index 34f3b25525c..dd5e21320d7 100644 --- a/lib/galaxy/authnz/custos_authnz.py +++ b/lib/galaxy/authnz/custos_authnz.py @@ -108,7 +108,7 @@ class CustosAuthnz(IdentityProvider): len(trans.app.auth_manager.authenticators) == 0): user = existing_user else: - message = 'There already exists a user this email. To associate this external login, you must first be logged in as that existing account.' + message = "There already exists a user with email %s. To associate this external login, you must first be logged in as that existing account." % email log.exception(message) raise exceptions.AuthenticationFailed(message) else: diff --git a/lib/galaxy/authnz/managers.py b/lib/galaxy/authnz/managers.py index e994605f08c..acea5314e0d 100644 --- a/lib/galaxy/authnz/managers.py +++ b/lib/galaxy/authnz/managers.py @@ -288,8 +288,7 @@ class AuthnzManager: return False, message, (None, None) return success, message, backend.callback(state_token, authz_code, trans, login_redirect_url) except exceptions.AuthenticationFailed as e: - log.exception(e.message) - raise exceptions.AuthenticationFailed(e.message) + raise except Exception as e: msg = 'The following error occurred when handling callback from `{}` identity provider: ' \ '{}'.format(provider, str(e)) diff --git a/lib/galaxy/webapps/galaxy/controllers/authnz.py b/lib/galaxy/webapps/galaxy/controllers/authnz.py index 1bc76272182..e2105d2a8dc 100644 --- a/lib/galaxy/webapps/galaxy/controllers/authnz.py +++ b/lib/galaxy/webapps/galaxy/controllers/authnz.py @@ -83,7 +83,7 @@ class OIDC(JSAppLauncher): login_redirect_url=url_for('/'), idphint=idphint) except exceptions.AuthenticationFailed as e: - return trans.response.send_redirect(trans.request.base + url_for('/') + 'root/login?message=' + (e.message or "Duplicate Email")) + raise if success is False: return trans.show_error_message(message) user = user if user is not None else trans.user From b9307f477ce7070765dc8a69e82e8ec3de27c3af Mon Sep 17 00:00:00 2001 From: Juleen Graham Date: Thu, 10 Sep 2020 01:16:48 -0400 Subject: [PATCH 2/3] fix py lint --- lib/galaxy/authnz/managers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/authnz/managers.py b/lib/galaxy/authnz/managers.py index acea5314e0d..2db729b677d 100644 --- a/lib/galaxy/authnz/managers.py +++ b/lib/galaxy/authnz/managers.py @@ -287,7 +287,7 @@ class AuthnzManager: if success is False: return False, message, (None, None) return success, message, backend.callback(state_token, authz_code, trans, login_redirect_url) - except exceptions.AuthenticationFailed as e: + except exceptions.AuthenticationFailed: raise except Exception as e: msg = 'The following error occurred when handling callback from `{}` identity provider: ' \ From 9707cbb0ec031e73254b3890f7f9d3df731b7a7c Mon Sep 17 00:00:00 2001 From: Juleen Graham Date: Thu, 10 Sep 2020 01:33:28 -0400 Subject: [PATCH 3/3] fix py lint --- lib/galaxy/webapps/galaxy/controllers/authnz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/authnz.py b/lib/galaxy/webapps/galaxy/controllers/authnz.py index e2105d2a8dc..3494097cab2 100644 --- a/lib/galaxy/webapps/galaxy/controllers/authnz.py +++ b/lib/galaxy/webapps/galaxy/controllers/authnz.py @@ -82,7 +82,7 @@ class OIDC(JSAppLauncher): trans, login_redirect_url=url_for('/'), idphint=idphint) - except exceptions.AuthenticationFailed as e: + except exceptions.AuthenticationFailed: raise if success is False: return trans.show_error_message(message)