From 73b3a61746844968bd1d401d19f9c58c7cc4d06a Mon Sep 17 00:00:00 2001 From: alexjanousekGSA Date: Fri, 4 Oct 2024 13:49:10 -0400 Subject: [PATCH] Moved condition back to top of method --- app/main/views/sign_in.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/main/views/sign_in.py b/app/main/views/sign_in.py index a8715301e..6f8d83609 100644 --- a/app/main/views/sign_in.py +++ b/app/main/views/sign_in.py @@ -203,6 +203,11 @@ def _handle_e2e_tests(redirect_url): # pragma: no cover @main.route("/sign-in", methods=(["GET", "POST"])) @hide_from_search_engines def sign_in(): # pragma: no cover + redirect_url = request.args.get("next") + + if os.getenv("NOTIFY_E2E_TEST_EMAIL"): + return _handle_e2e_tests(redirect_url) + # If we have to revalidated the email, send the message # via email and redirect to the "verify your email page" # and don't proceed further with login @@ -214,11 +219,6 @@ def sign_in(): # pragma: no cover ): return email_verify_template - redirect_url = request.args.get("next") - - if os.getenv("NOTIFY_E2E_TEST_EMAIL"): - return _handle_e2e_tests(redirect_url) - if current_user and current_user.is_authenticated: if redirect_url and is_safe_redirect_url(redirect_url): return redirect(redirect_url)