示例#1
0
    def clean_password1(self):
        """Adds to the default password validation routine in order to enforce
        stronger passwords"""
        password = self.cleaned_data['password1']
        errors = models.password_errors(password)

        # If password_validator returns errors, raise an error, else proceed.
        if errors:
            raise forms.ValidationError('\n'.join(errors))
        else:
            return password
    def clean_password1(self):
        """Adds to the default password validation routine in order to enforce
        stronger passwords"""
        password = self.cleaned_data['password1']
        errors = models.password_errors(password)

        # If password_validator returns errors, raise an error, else proceed.
        if errors:
            raise forms.ValidationError('\n'.join(errors))
        else:
            return password
示例#3
0
    def clean_new_password1(self):
        """Adds to the default password validation routine in order to enforce
        stronger passwords"""
        password = self.cleaned_data['new_password1']
        errors = models.password_errors(password)
        # Also check that this is a new password
        if self.user.check_password(self.cleaned_data['new_password1']):
            errors.append("Must not reuse a password")

        # If password_validator returns errors, raise an error, else proceed.
        if errors:
            raise forms.ValidationError('\n'.join(errors))
        else:
            return password
    def clean_new_password1(self):
        """Adds to the default password validation routine in order to enforce
        stronger passwords"""
        password = self.cleaned_data['new_password1']
        errors = models.password_errors(password)
        # Also check that this is a new password
        if self.user.check_password(self.cleaned_data['new_password1']):
            errors.append("Must not reuse a password")

        # If password_validator returns errors, raise an error, else proceed.
        if errors:
            raise forms.ValidationError('\n'.join(errors))
        else:
            return password