(20241128) Serving HTML on redirect.
This commit is contained in:
@@ -40,7 +40,7 @@ sys.path.append(".")
|
||||
sys.path.append("..")
|
||||
|
||||
# For using Quart:
|
||||
from quart import Blueprint, current_app, request
|
||||
from quart import Blueprint, current_app, request, render_template
|
||||
|
||||
# My utils:
|
||||
from utils_v2.string import json
|
||||
@@ -133,6 +133,7 @@ async def mail_callback(
|
||||
|
||||
"""
|
||||
Use this when authorizing access to someone's GMail account. This can be used to capture the authentication token.
|
||||
:param mail_client: The mail company/brand that you want the authorization from.
|
||||
:param inbound_headers: auto-extracted by the decorators.
|
||||
:param inbound_data: auto-extracted by the decorators.
|
||||
:param inbound_files: auto-extracted by the decorators.
|
||||
@@ -173,14 +174,20 @@ async def mail_callback(
|
||||
# ┛┗┗ ┛┣┛┗┛┛┗┛┗
|
||||
# ┛
|
||||
|
||||
# Return a success response:
|
||||
return ResponseModel(
|
||||
status_code = StatusCodes.OK if tokens_saved else StatusCodes.FAILED,
|
||||
http_code = HttpCodes.SUCCESS if tokens_saved else HttpCodes.INTERNAL_SERVER_ERROR,
|
||||
data = {
|
||||
"mailClient": mail_client,
|
||||
"authorized": True
|
||||
}
|
||||
# # Return a response:
|
||||
# return ResponseModel(
|
||||
# status_code = StatusCodes.OK if tokens_saved else StatusCodes.FAILED,
|
||||
# http_code = HttpCodes.SUCCESS if tokens_saved else HttpCodes.INTERNAL_SERVER_ERROR,
|
||||
# data = {
|
||||
# "mailClient": mail_client,
|
||||
# "authorized": True
|
||||
# }
|
||||
# )
|
||||
|
||||
# Return a page that shows you the status of your authorization:
|
||||
return await render_template(
|
||||
"/mail/oauth/oauth_success.html" if tokens_saved else "/mail/oauth/oauth_failure.html",
|
||||
mail_client = mail_client.title()
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user