(20241203) Trying to fix the 'Close' button on the OAuth callback views.

This commit is contained in:
2024-12-03 17:45:40 +05:30
parent b6274ca7a4
commit 531b664a9d
+4 -4
View File
@@ -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."