Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LoginForm(forms.Form):
- email = forms.EmailField()
- password = forms.CharField(widget=forms.PasswordInput)
- #This Method Hash the password
- def clean_password(self):
- clearPassNoHash = self.cleaned_data['password']
- self.password = md5.new(clearPassNoHash).hexdigest()
- return self.password
- def auth_login(request):
- args = {}
- form = LoginForm(request.POST)
- email = request.POST['email']
- password = request.POST['password']
- user = authenticate(email=email, password=password)
- if user is not None:
- login(request, user)
- print("Exist")
- else:
- print("Does not exist")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement