(20250221) Session token handling to avoid exception in timed OTP APIs.
This commit is contained in:
@@ -163,14 +163,11 @@ async def generate_otp(
|
|||||||
|
|
||||||
# Either the session must be valid, or
|
# Either the session must be valid, or
|
||||||
# the IP address requesting the service must be whitelisted:
|
# the IP address requesting the service must be whitelisted:
|
||||||
if (
|
if kwargs.get("session_info") is None:
|
||||||
kwargs.get("session_info") is None and
|
|
||||||
inbound_headers["Remote-IP"] not in current_app.whitelisted_ips
|
|
||||||
):
|
|
||||||
return ResponseModel(
|
return ResponseModel(
|
||||||
status_code = StatusCodes.FAILED,
|
status_code = StatusCodes.FAILED,
|
||||||
http_code = HttpCodes.UNAUTHORIZED,
|
http_code = HttpCodes.UNAUTHORIZED,
|
||||||
message = "Invalid session and/or bad IP addr."
|
message = "Invalid session."
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get the user's info:
|
# Get the user's info:
|
||||||
@@ -304,14 +301,11 @@ async def verify_otp(
|
|||||||
|
|
||||||
# Either the session must be valid, or
|
# Either the session must be valid, or
|
||||||
# the IP address requesting the service must be whitelisted:
|
# the IP address requesting the service must be whitelisted:
|
||||||
if (
|
if kwargs.get("session_info") is None:
|
||||||
kwargs.get("session_info") is None and
|
|
||||||
inbound_headers["Remote-IP"] not in current_app.whitelisted_ips
|
|
||||||
):
|
|
||||||
return ResponseModel(
|
return ResponseModel(
|
||||||
status_code = StatusCodes.FAILED,
|
status_code = StatusCodes.FAILED,
|
||||||
http_code = HttpCodes.UNAUTHORIZED,
|
http_code = HttpCodes.UNAUTHORIZED,
|
||||||
message = "Invalid session and/or bad IP addr."
|
message = "Invalid session."
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get the user's info:
|
# Get the user's info:
|
||||||
|
|||||||
Reference in New Issue
Block a user