This commit is contained in:
Raphael Rouiller
2024-07-08 14:06:52 +02:00
commit aa54287126
96 changed files with 2718 additions and 0 deletions

View File

@ -0,0 +1,21 @@
from django.core.exceptions import ValidationError
class SpecialCharacterValidator:
def validate(self, password, user=None):
if not any(char in '@$!%*?&' for char in password):
raise ValidationError(
"The password must contain at least one special character (@$!%*?&)."
)
def get_help_text(self):
return "Your password must contain at least one special character (@$!%*?&)."
class UppercaseValidator:
def validate(self, password, user=None):
if not any(char.isupper() for char in password):
raise ValidationError(
"The password must contain at least one uppercase letter."
)
def get_help_text(self):
return "Your password must contain at least one uppercase letter."