Pass login error message to client
This commit is contained in:
parent
652ef3fb8d
commit
77d961376e
|
@ -51,9 +51,13 @@ def login(request):
|
|||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
post_data = {'user_name': username, 'web_pw': password, 'SubmitButton': 'Login'}
|
||||
res = requests.post(PROTOSPACE_LOGIN_PAGE, post_data, allow_redirects=False)
|
||||
try:
|
||||
res = requests.post(PROTOSPACE_LOGIN_PAGE, post_data, allow_redirects=False, timeout=2)
|
||||
except:
|
||||
return Response({'error': 'Problem reaching my.protospace.ca'}, status=status.HTTP_503_SERVICE_UNAVAILABLE)
|
||||
|
||||
if res.status_code == requests.codes.ok:
|
||||
return Response({'error': 'Invalid Credentials'}, status=status.HTTP_404_NOT_FOUND)
|
||||
return Response({'error': 'Invalid username / password'}, status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
lockout_username = username.replace('.', '')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user