From eb840585a77f399014436cda3976bb7345a5183d Mon Sep 17 00:00:00 2001 From: venusbb Date: Thu, 28 Sep 2017 10:17:59 +0100 Subject: [PATCH] Inbound sms ip messages --- app/authentication/auth.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/authentication/auth.py b/app/authentication/auth.py index bd71d3927..a99d03593 100644 --- a/app/authentication/auth.py +++ b/app/authentication/auth.py @@ -70,11 +70,6 @@ def restrict_ip_sms(): for allowed_ip in allowed_ips ) - if allowed: - return - else: - raise AuthError('Unknown source IP address from the SMS provider', 403) - current_app.logger.info({ 'message': 'Inbound sms ip address', 'log_contents': { @@ -82,11 +77,12 @@ def restrict_ip_sms(): 'ip_address': inbound_ip } }) - return - current_app.logger.error('Traffic from unknown source or route, X-Forwarded-For="{}"'.format( - request.headers.get("X-Forwarded-For")) - ) + if allowed: + return + else: + raise AuthError('Unknown source IP address from the SMS provider', 403) + raise AuthError('Traffic from unknown source or route', 403)