diff --git a/AUTHORS b/AUTHORS index 4a3e397744..0bbb85d7f8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -70,6 +70,7 @@ Guoyu Hao Haesung Park Hatem Nassrat Hyunwoo Shim +Ian R-P Ignacio Ocampo Illia Volochii J. Erm diff --git a/ChangeLog.rst b/ChangeLog.rst index 6da9a17f60..bd7596e3ba 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -4,6 +4,7 @@ Note worthy changes ------------------- +- Added django password validation help text to password1 on set/change/signup forms. - ... diff --git a/allauth/account/forms.py b/allauth/account/forms.py index fa44cf3fa8..eb396f0395 100644 --- a/allauth/account/forms.py +++ b/allauth/account/forms.py @@ -3,6 +3,7 @@ from importlib import import_module from django import forms +from django.contrib.auth import password_validation from django.contrib.auth.tokens import PasswordResetTokenGenerator from django.contrib.sites.shortcuts import get_current_site from django.core import exceptions, validators @@ -394,7 +395,9 @@ class SignupForm(BaseSignupForm): def __init__(self, *args, **kwargs): super(SignupForm, self).__init__(*args, **kwargs) self.fields["password1"] = PasswordField( - label=_("Password"), autocomplete="new-password" + label=_("Password"), + autocomplete="new-password", + help_text=password_validation.password_validators_help_text_html(), ) if app_settings.SIGNUP_PASSWORD_ENTER_TWICE: self.fields["password2"] = PasswordField( @@ -502,7 +505,10 @@ class ChangePasswordForm(PasswordVerificationMixin, UserForm): oldpassword = PasswordField( label=_("Current Password"), autocomplete="current-password" ) - password1 = SetPasswordField(label=_("New Password")) + password1 = SetPasswordField( + label=_("New Password"), + help_text=password_validation.password_validators_help_text_html(), + ) password2 = PasswordField(label=_("New Password (again)")) def __init__(self, *args, **kwargs): @@ -519,7 +525,10 @@ def save(self): class SetPasswordForm(PasswordVerificationMixin, UserForm): - password1 = SetPasswordField(label=_("Password")) + password1 = SetPasswordField( + label=_("Password"), + help_text=password_validation.password_validators_help_text_html(), + ) password2 = PasswordField(label=_("Password (again)")) def __init__(self, *args, **kwargs):