Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user = authenticate(username, password)
- username = self.cleaned_data.get('username')
- password = self.cleaned_data.get('password')
- # check if user exists
- try:
- user = User.objects.get(username=username)
- except User.DoesNotExist:
- user = None
- #check if user is_active
- if user.is_active:
- user_active = true
- else
- user_active = false
- #check the password
- if user_active:
- password_match = user.check_password(password):
- else:
- password_match = false
- if password_match:
- msg = "Login Successful"
- else:
- msg = "Login Failed"
Add Comment
Please, Sign In to add comment