(20241214) SMS also ported to the 'tokenKey' system.
This commit is contained in:
@@ -145,26 +145,38 @@ async def send_sms(
|
||||
:return: A standard response structure.
|
||||
"""
|
||||
|
||||
# ┏┓
|
||||
# ┃┃┏┓┏┓┏┓┏┓┏┓┏┏┓┏┏
|
||||
# ┣┛┛ ┗ ┣┛┛ ┗┛┗┗ ┛┛
|
||||
# ┛
|
||||
# ┏┓ ┓ ┏┓┓ ┓
|
||||
# ┣┫┓┏╋┣┓ ┃ ┣┓┏┓┏┃┏
|
||||
# ┛┗┗┻┗┛┗ ┗┛┛┗┗ ┗┛┗
|
||||
|
||||
# If the session token is invalid/expired:
|
||||
if kwargs.get("session_info") is None:
|
||||
return ResponseModel(
|
||||
status_code = StatusCodes.FAILED,
|
||||
http_code = HttpCodes.UNAUTHORIZED
|
||||
http_code = HttpCodes.UNAUTHORIZED,
|
||||
message = "invalid session"
|
||||
)
|
||||
|
||||
# ┏┓ ┓ ┏┳┓┓ ┏┓┳┳┓┏┓
|
||||
# ┗┓┏┓┏┓┏┫ ┃ ┣┓┏┓ ┗┓┃┃┃┗┓
|
||||
# ┗┛┗ ┛┗┗┻ ┻ ┛┗┗ ┗┛┛ ┗┗┛
|
||||
|
||||
# Get the token from the token key:
|
||||
auth_token = await current_app.mail_controller.get_token(
|
||||
mongo_conn = current_app.data_mongo,
|
||||
token_key = inbound_data.tokenKey
|
||||
)
|
||||
if auth_token is None: return ResponseModel(
|
||||
status_code = StatusCodes.FAILED,
|
||||
http_code = HttpCodes.UNAUTHORIZED,
|
||||
message = f"no such token key"
|
||||
)
|
||||
|
||||
# Send the SMS:
|
||||
client_response = await current_app.sms_controller.send(
|
||||
mongo_conn = current_app.data_mongo,
|
||||
http_client = current_app.http_client,
|
||||
token_id = inbound_data.tokenId,
|
||||
auth_token = auth_token,
|
||||
messages = inbound_data.message
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user