mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-05 08:10:39 +00:00
32 lines
940 B
Diff
32 lines
940 B
Diff
diff --git a/django/contrib/auth/validators.py b/django/contrib/auth/validators.py
|
|
new file mode 100644
|
|
index 0000000..74e31f5
|
|
--- /dev/null
|
|
+++ b/django/contrib/auth/validators.py
|
|
@@ -0,0 +1,25 @@
|
|
+import re
|
|
+
|
|
+from django.core import validators
|
|
+from django.utils.deconstruct import deconstructible
|
|
+from django.utils.translation import gettext_lazy as _
|
|
+
|
|
+
|
|
+@deconstructible
|
|
+class ASCIIUsernameValidator(validators.RegexValidator):
|
|
+ regex = r'\A[\w.@+-]+\Z'
|
|
+ message = _(
|
|
+ 'Enter a valid username. This value may contain only English letters, '
|
|
+ 'numbers, and @/./+/-/_ characters.'
|
|
+ )
|
|
+ flags = re.ASCII
|
|
+
|
|
+
|
|
+@deconstructible
|
|
+class UnicodeUsernameValidator(validators.RegexValidator):
|
|
+ regex = r'\A[\w.@+-]+\Z'
|
|
+ message = _(
|
|
+ 'Enter a valid username. This value may contain only letters, '
|
|
+ 'numbers, and @/./+/-/_ characters.'
|
|
+ )
|
|
+ flags = 0
|
|
\ No newline at end of file
|