django-user-accounts icon indicating copy to clipboard operation
django-user-accounts copied to clipboard

fixes #266 settings.AUTH_PASSWORD_VALIDATORS ignored

Open davidegalletti opened this issue 7 years ago • 5 comments

davidegalletti avatar Sep 08 '17 10:09 davidegalletti

Would love to see the one merged 😃

the-chris-mitchell avatar Oct 24 '17 09:10 the-chris-mitchell

@brosner could you take a look at this?

the-chris-mitchell avatar Nov 20 '17 08:11 the-chris-mitchell

@davidegalletti I think this is a nice attempt but only covers signup password validation. It would also be nice to see change password and password reset management as well. Still appreciative either way.

avelis avatar May 02 '18 15:05 avelis

Would love to see this get attention. For now I've been overriding the forms.py from within my project for views requiring additional validations, and implementing my own validations manually...

*forms.py*

from django.utils.translation import ugettext_lazy as _
class ChangePasswordForm(account.forms.ChangePasswordForm):

   def clean_password_new_confirm(self):


       if "password_new" in self.cleaned_data and "password_new_confirm" in self.cleaned_data:
           if self.cleaned_data["password_new"] != self.cleaned_data["password_new_confirm"]:
               raise forms.ValidationError(_("You must type the same password each time."))

           if len(self.cleaned_data["password_new"]) < 10:
               raise forms.ValidationError(_("Password must be at least 10 digits."))

       return self.cleaned_data["password_new_confirm"]

*views.py*

from .forms import ChangePasswordForm
class ChangePasswordView(account.views.ChangePasswordView):
   form_class = ChangePasswordForm
   pass


*urls.py*

   path("account/password/", views.ChangePasswordView.as_view(), name="account_password"),


patrickscottbest avatar Jan 14 '19 14:01 patrickscottbest

@davidegalletti - can you fix conflicts and remove the check on Django version since projects should no longer be using DJango 1 or even Django 2 for that matter. I will merge when you provide the changes.

uhurusurfa avatar Feb 09 '23 09:02 uhurusurfa