Advertisement
Guest User

Untitled

a guest
May 27th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. class LoginForm(forms.Form):
  2. email = forms.EmailField()
  3. password = forms.CharField(widget=forms.PasswordInput)
  4.  
  5. #This Method Hash the password
  6. def clean_password(self):
  7. clearPassNoHash = self.cleaned_data['password']
  8. self.password = md5.new(clearPassNoHash).hexdigest()
  9. return self.password
  10.  
  11. def auth_login(request):
  12. args = {}
  13. form = LoginForm(request.POST)
  14. email = request.POST['email']
  15. password = request.POST['password']
  16. user = authenticate(email=email, password=password)
  17. if user is not None:
  18. login(request, user)
  19. print("Exist")
  20. else:
  21. print("Does not exist")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement