(20241203) Solutions didn'r work. Reverting.

This commit is contained in:
2024-12-03 17:54:05 +05:30
parent bf7064c30f
commit e608ddd7be
+5 -7
View File
@@ -117,7 +117,7 @@ async def handle_gmail_callback() -> render_template:
tokens_saved = False tokens_saved = False
# In case the user cancelled halfway through (on Google's screen): # In case the user cancelled halfway through (on Google's screen):
if g.inbound_data.get("error") == "access_denied": return render_template( if g.inbound_data.get("error") == "access_denied": return await render_template(
"/mail/oauth/oauth_cancelled_v2.html", "/mail/oauth/oauth_cancelled_v2.html",
mail_client = g.mail_client.title() mail_client = g.mail_client.title()
) )
@@ -147,7 +147,7 @@ async def handle_gmail_callback() -> render_template:
if ( if (
(not placeholder_token) or (not placeholder_token) or
placeholder_token["clientUserId"]["email"] != str(tokens.email) placeholder_token["clientUserId"]["email"] != str(tokens.email)
): return render_template( ): return await render_template(
"/mail/oauth/oauth_failure_v2.html", "/mail/oauth/oauth_failure_v2.html",
mail_client = g.mail_client.title(), 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." 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: # Return an HTML response for success:
if tokens_saved: await render_template( if tokens_saved: return await render_template(
"/mail/oauth/oauth_success_v2.html", "/mail/oauth/oauth_success_v2.html",
mail_client = g.mail_client.title() mail_client = g.mail_client.title()
) )
# Return an HTML response for failure: # Return an HTML response for failure:
else: return render_template( else: return await render_template(
"/mail/oauth/oauth_failure_v2.html", "/mail/oauth/oauth_failure_v2.html",
mail_client = g.mail_client.title(), mail_client = g.mail_client.title(),
failure_hint = f"Unknown error. Please use log-id '{g.log_id}' to check with the support team." failure_hint = f"Unknown error. Please use log-id '{g.log_id}' to check with the support team."
@@ -262,9 +262,7 @@ async def mail_callback(
# ┣┫┏┓┏┓┏┫┃┏┓ ┃ ┏┓┃┃┣┓┏┓┏┃┏┏ # ┣┫┏┓┏┓┏┫┃┏┓ ┃ ┏┓┃┃┣┓┏┓┏┃┏┏
# ┛┗┗┻┛┗┗┻┗┗ ┗┛┗┻┗┗┗┛┗┻┗┛┗┛ # ┛┗┗┻┛┗┗┻┗┗ ┗┛┗┻┗┗┗┛┗┻┗┛┗┛
if mail_client == "gmail": if mail_client == "gmail": return await handle_gmail_callback()
template = await handle_gmail_callback()
return await template
# ┓┏ ┓┓ ┳ ┓• ┓ ┏┓┓• # ┓┏ ┓┓ ┳ ┓• ┓ ┏┓┓•
# ┣┫┏┓┏┓┏┫┃┏┓ ┃┏┓┓┏┏┓┃┓┏┫ ┃ ┃┓┏┓┏┓╋ # ┣┫┏┓┏┓┏┫┃┏┓ ┃┏┓┓┏┏┓┃┓┏┫ ┃ ┃┓┏┓┏┓╋