def clean_new_password1(self): password1 = self.cleaned_data.get('new_password1') if not is_password_strong(password1): raise forms.ValidationError(u'Your password was found to be insecure, a good password has a combination of letters (uppercase, lowercase), numbers and is at least 8 characters long.') return password1
def clean(self): data = self.cleaned_data if data.get('new1') and data.get('new2'): if data['new1'] != data['new2']: raise forms.ValidationError(u'You must type the same password each time') if not is_password_strong(data['new1'], data.get('old', None)): raise forms.ValidationError(u'Your password was found to be insecure, a good password has a combination of letters (uppercase, lowercase), numbers and is at least 8 characters long.') return data