Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ChangePasswordForm(forms.Form):
- password1 = forms.CharField(label='New Password',widget=forms.PasswordInput())
- password2 = forms.CharField(label='Confirm Password',widget=forms.PasswordInput())
- def clean_password1(self):
- password1 = self.cleaned_data.get("password1")
- return password1
- def clean_passwords(self):
- password1 = self.cleaned_data.get("password1")
- password2 = self.cleaned_data.get("password2")
- if password1 != password2:
- raise forms.ValidationError('The passwords do not match.')
- elif password1 == "" or password2 == "":
- raise forms.ValidationError('Neither of the Fields can be blank!')
- elif password1 == "changeme" or password2 == "changeme":
- raise forms.ValidationError('You cannot use that password!')
- else:
- return password2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement