Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #266 settings.AUTH_PASSWORD_VALIDATORS ignored #267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidegalletti
Copy link

No description provided.

@the-chris-mitchell
Copy link

Would love to see the one merged 😃

@the-chris-mitchell
Copy link

@brosner could you take a look at this?

@avelis
Copy link

avelis commented May 2, 2018

@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.

@patrickscottbest
Copy link

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"),


@uhurusurfa
Copy link
Collaborator

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants