Guest User

Untitled

a guest
May 15th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. Traceback:
  2. File "D:Pythonlibsite-packagesdjangocorehandlersexception.py" in inner
  3. 35 response = get_response(request)
  4.  
  5. File "D:Pythonlibsite-packagesdjangocorehandlersbase.py" in _get_response
  6. 128 response = self.process_exception_by_middleware(e, request)
  7.  
  8. File "D:Pythonlibsite-packagesdjangocorehandlersbase.py" in _get_response
  9. 126 response = wrapped_callback(request, *callback_args, **callback_kwargs)
  10.  
  11. File "d:ProgramsPythonDjangotest2accountsviews.py" in login_user
  12. 52 user = authenticate(request=request, email=email, password=password)
  13.  
  14. File "D:Pythonlibsite-packagesdjangocontribauth__init__.py" in authenticate
  15. 70 user = _authenticate_with_backend(backend, backend_path, request, credentials)
  16.  
  17. File "D:Pythonlibsite-packagesdjangocontribauth__init__.py" in _authenticate_with_backend
  18. 116 return backend.authenticate(*args, **credentials)
  19.  
  20. File "d:ProgramsPythonDjangotest2accountsbackends.py" in authenticate
  21. 29 if MyUser.check_password(password):
  22.  
  23. Exception Type: TypeError at /accounts/login/
  24. Exception Value: check_password() missing 1 required positional argument: 'raw_password'
  25.  
  26. class EmailAuthenticationBackend(ModelBackend):
  27. def authenticate(self, request, email=None, password=None):
  28. MyUser = get_user_model()
  29.  
  30. try:
  31. # Check the email/password and return a user
  32. user = MyUser.objects.get(email=email)
  33.  
  34. # BUG
  35. if MyUser.check_password(password):
  36. return user
  37.  
  38. except MyUser.DoesNotExist:
  39. return None
  40.  
  41. def login_user(request):
  42. template_name = 'registration/login.html'
  43.  
  44. if request.method == 'POST':
  45. email = request.POST['email']
  46. password = request.POST['password']
  47. user = authenticate(request=request, email=email, password=password)
Add Comment
Please, Sign In to add comment