Stop non-ascii passwords being used

This commit is contained in:
2012-08-09 20:05:55 +01:00
parent 12ad30a685
commit acc7a5c669

View File

@@ -117,6 +117,12 @@ class APIPasswordForm(forms.Form):
def clean_password2(self):
password1 = self.cleaned_data.get('password')
password2 = self.cleaned_data.get('password2')
try:
password1.decode('ascii')
except UnicodeEncodeError:
raise forms.ValidationError("Please use ASCII only for your service password.")
if password1 and password2:
if password1 != password2:
raise forms.ValidationError("The two passwords do not match.")