(20241223) Zerodha auth now returns views.

This commit is contained in:
2024-12-23 16:27:52 +05:30
parent 3296fec639
commit 58e91fb15f
16 changed files with 112 additions and 294 deletions
+6 -6
View File
@@ -134,7 +134,7 @@ async def handle_gmail_callback() -> render_template:
# In case the user cancelled halfway through (on Google's screen):
if g.inbound_data.get("error") == "access_denied": return await render_template(
"/mail/oauth/oauth_cancelled_v2.html",
"/message/mail/oauth/oauth_cancelled_v2.html",
mail_client = g.mail_client.title()
)
@@ -167,7 +167,7 @@ async def handle_gmail_callback() -> render_template:
(not auth_token) or
auth_token.clientUserId["email"] != str(google_tokens.email)
): return await render_template(
"/mail/oauth/oauth_failure_v2.html",
"/message/mail/oauth/oauth_failure_v2.html",
mail_client = g.mail_client.title(),
failure_hint = (
f"We were expecting authorization from '{auth_token.clientUserId['email']}', "
@@ -224,13 +224,13 @@ async def handle_gmail_callback() -> render_template:
# Return an HTML response for success:
if tokens_saved: return await render_template(
"/mail/oauth/oauth_success_v2.html",
"/message/mail/oauth/oauth_success_v2.html",
mail_client = g.mail_client.title()
)
# Return an HTML response for failure:
else: return await render_template(
"/mail/oauth/oauth_failure_v2.html",
"/message/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."
)
@@ -292,7 +292,7 @@ async def mail_auth_callback(
# If something goes wrong:
except Exception as exception: return await render_template(
"/mail/oauth/oauth_failure_v2.html",
"/message/mail/oauth/oauth_failure_v2.html",
mail_client = mail_client.title(),
failure_hint = (
f"An internal server error occurred. "
@@ -305,7 +305,7 @@ async def mail_auth_callback(
# ┛┗┗┻┛┗┗┻┗┗ ┻┛┗┗┛┗┻┗┗┗┻ ┗┛┗┗┗ ┛┗┗
return await render_template(
"/mail/oauth/oauth_failure_v2.html",
"/message/mail/oauth/oauth_failure_v2.html",
mail_client = mail_client.title(),
failure_hint = (
f"Invalid client '{mail_client}' selected. "