diff options
author | Markus Krogh <markus@nordu.net> | 2018-06-13 13:42:47 +0200 |
---|---|---|
committer | Markus Krogh <markus@nordu.net> | 2018-06-13 13:42:47 +0200 |
commit | 3c0dce89d456c04767ec3607d9de1c9c8056a6ee (patch) | |
tree | f6d99d492a7ab42afe6c691b7351cea1ce491e7d /src/apps/changepw/models.py | |
parent | 809a262ce8e0c7593487aeb921d3f72092b76788 (diff) |
Remove python pwman
Diffstat (limited to 'src/apps/changepw/models.py')
-rw-r--r-- | src/apps/changepw/models.py | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/apps/changepw/models.py b/src/apps/changepw/models.py deleted file mode 100644 index 24e0bec..0000000 --- a/src/apps/changepw/models.py +++ /dev/null @@ -1,34 +0,0 @@ -from django import forms -import re - -class ChangePasswordForm(forms.Form): - new_password = forms.CharField(widget=forms.PasswordInput) - new_password_again = forms.CharField(widget=forms.PasswordInput) - - def clean(self): - ''' - Validate the password submitted. - ''' - cleaned_data = self.cleaned_data - # The two submitted strings need to match. - new_password = cleaned_data.get('new_password') - new_password_again = cleaned_data.get('new_password_again') - if new_password != new_password_again: - raise forms.ValidationError('The typed passwords do not \ -match.') - # Check that the length is at least 10 characters. - if not len(new_password) >= 10: - raise forms.ValidationError('Your password needs to be at \ -least 10 characters long. Currently %d characters.' % len(new_password)) - # The password needs to contain at least one upper and one lower case - # letter and three numbers or special characters. - if not re.search('[a-z]', new_password) or not re.search( - '[A-Z]', new_password): - raise forms.ValidationError('You need at least one upper \ -case letter and one lower case letter in your password.') - numbers = re.findall('\d', new_password) - specials = re.findall('[,.\[\]!@#$%^&*?_\(\)-]', new_password) - if (len(numbers)+len(specials)) < 3: - raise forms.ValidationError('You need at least three numbers or \ -special characters i.e. 1234567890,.][!@#$%^&*?_()-') - return cleaned_data |