(20250221) Session token handling to avoid exception in timed OTP APIs.

This commit is contained in:
2025-02-21 11:13:31 +05:30
parent d16fa61ec3
commit 3f23e186ba
+4 -10
View File
@@ -163,14 +163,11 @@ async def generate_otp(
# Either the session must be valid, or
# the IP address requesting the service must be whitelisted:
if (
kwargs.get("session_info") is None and
inbound_headers["Remote-IP"] not in current_app.whitelisted_ips
):
if kwargs.get("session_info") is None:
return ResponseModel(
status_code = StatusCodes.FAILED,
http_code = HttpCodes.UNAUTHORIZED,
message = "Invalid session and/or bad IP addr."
message = "Invalid session."
)
# Get the user's info:
@@ -304,14 +301,11 @@ async def verify_otp(
# Either the session must be valid, or
# the IP address requesting the service must be whitelisted:
if (
kwargs.get("session_info") is None and
inbound_headers["Remote-IP"] not in current_app.whitelisted_ips
):
if kwargs.get("session_info") is None:
return ResponseModel(
status_code = StatusCodes.FAILED,
http_code = HttpCodes.UNAUTHORIZED,
message = "Invalid session and/or bad IP addr."
message = "Invalid session."
)
# Get the user's info: