Commit 1044fc0b authored by lukas.burgey's avatar lukas.burgey

Make error messages better

parent ba3b2dbc
......@@ -47,13 +47,6 @@ def _apiclient_valid(request):
return True
return False
def _apiclient_get(request):
return User.objects.get(
user_type=User.TYPE_CHOICE_DOWNSTREAM,
username=request.POST.get('username'),
)
def _webpage_client_userid(request):
userid = ''
username = request.POST.get('username')
......@@ -188,8 +181,8 @@ def topic_endpoint_webpageclient(request, webpage_client_userid):
User.objects.get(id=webpage_client_userid)
return topic_auth_decision(request, ALLOW)
except User.DoesNotExist as error:
LOGGER.info(error)
except User.DoesNotExist:
LOGGER.info('User %s does not exist', webpage_client_userid)
return topic_auth_decision(request, DENY)
......@@ -252,9 +245,12 @@ def topic_endpoint(request):
return topic_endpoint_webpageclient(request, webpage_client_userid)
try:
apiclient = _apiclient_get(request)
apiclient = User.objects.get(
user_type=User.TYPE_CHOICE_DOWNSTREAM,
username=request.POST.get('username'),
)
return topic_endpoint_apiclient(request, apiclient)
except User.DoesNotExist as e:
LOGGER.debug('Auth: Topic endpoint: %s', e)
except User.DoesNotExist:
LOGGER.info('User %s does not exist', request.POST.get('username', ''))
return topic_auth_decision(request, DENY)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment