From 531b664a9d8e46f5eff0cc57c93c8a3ef6a3a01e Mon Sep 17 00:00:00 2001 From: khushal Date: Tue, 3 Dec 2024 17:45:40 +0530 Subject: [PATCH] (20241203) Trying to fix the 'Close' button on the OAuth callback views. --- api/blueprints/mail/oauth_callback.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/blueprints/mail/oauth_callback.py b/api/blueprints/mail/oauth_callback.py index b840f32..a488567 100644 --- a/api/blueprints/mail/oauth_callback.py +++ b/api/blueprints/mail/oauth_callback.py @@ -117,7 +117,7 @@ async def handle_gmail_callback() -> render_template: tokens_saved = False # In case the user cancelled halfway through (on Google's screen): - if g.inbound_data.get("error") == "access_denied": return await render_template( + if g.inbound_data.get("error") == "access_denied": return render_template( "/mail/oauth/oauth_cancelled_v2.html", mail_client = g.mail_client.title() ) @@ -147,7 +147,7 @@ async def handle_gmail_callback() -> render_template: if ( (not placeholder_token) or placeholder_token["clientUserId"]["email"] != str(tokens.email) - ): return await render_template( + ): return render_template( "/mail/oauth/oauth_failure_v2.html", mail_client = g.mail_client.title(), failure_hint = f"We were expecting authorization from '{placeholder_token['clientUserId']['email']}' but got authorization from '{tokens.email}' instead." @@ -199,13 +199,13 @@ async def handle_gmail_callback() -> render_template: ) # Return an HTML response for success: - if tokens_saved: return await render_template( + if tokens_saved: await render_template( "/mail/oauth/oauth_success_v2.html", mail_client = g.mail_client.title() ) # Return an HTML response for failure: - else: return await render_template( + else: return render_template( "/mail/oauth/oauth_failure_v2.html", mail_client = g.mail_client.title(), failure_hint = f"Unknown error. Please use log-id '{g.log_id}' to check with the support team."