(20250115) Allowing internal IPs to send SMS messages.

This commit is contained in:
2025-01-15 14:00:40 +05:30
parent 3c7ce68200
commit 9e80fda596
3 changed files with 20 additions and 7 deletions
+7 -3
View File
@@ -207,12 +207,16 @@ async def send_sms_messages_api(
# ┣┫┓┏╋┣┓ ┃ ┣┓┏┓┏┃┏
# ┛┗┗┻┗┛┗ ┗┛┛┗┗ ┗┛┗
# If the session token is invalid/expired:
if kwargs.get("session_info") is None:
# 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
):
return ResponseModel(
status_code = StatusCodes.FAILED,
http_code = HttpCodes.UNAUTHORIZED,
message = "invalid session"
message = "Invalid session and/or bad IP addr."
)
# Get the token from the token key: