Skip to content

Commit 904bc9b

Browse files
authored
Merge pull request #4 from QueraTeam/fix-validators-help-texts
Add missing get_help_text methods to all validators.
2 parents 6597e25 + 7b066b5 commit 904bc9b

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

django_pwned/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.2.1"
1+
__version__ = "1.2.2"
232 Bytes
Binary file not shown.

django_pwned/locale/fa/LC_MESSAGES/django.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ msgstr ""
3737
#: validators.py
3838
msgid "Make sure password has at least %(min_unique_characters)d unique characters."
3939
msgstr "گذرواژه باید حداقل %(min_unique_characters)d کاراکتر متمایز داشته باشد."
40+
41+
#: validators.py
42+
msgid "Your password should contain at least %(min_unique_characters)d unique characters."
43+
msgstr "گذرواژه شما باید حداقل %(min_unique_characters)d کاراکتر متمایز داشته باشد."

django_pwned/validators.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ def validate(self, password: str, user=None):
7676
code="password_github_like_validator",
7777
)
7878

79+
def get_help_text(self):
80+
return _("Passwords shorter than %(safe_length)d characters must include a number and a lowercase letter.") % {
81+
"safe_length": self.safe_length
82+
}
83+
7984

8085
class MinimumUniqueCharactersPasswordValidator:
8186
"""
@@ -96,3 +101,8 @@ def validate(self, password: str, user=None):
96101
% {"min_unique_characters": self.min_unique_characters},
97102
code="password_min_unique_characters_validator",
98103
)
104+
105+
def get_help_text(self):
106+
return _("Your password should contain at least %(min_unique_characters)d unique characters.") % {
107+
"min_unique_characters": self.min_unique_characters
108+
}

0 commit comments

Comments
 (0)