mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-08-19 01:06:10 +02:00
MediaCMS backend, initial commit
This commit is contained in:
18
users/validators.py
Normal file
18
users/validators.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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"^[\w]+$"
|
||||
message = _(
|
||||
"Enter a valid username. This value may contain only "
|
||||
"English letters and numbers"
|
||||
)
|
||||
flags = re.ASCII
|
||||
|
||||
|
||||
custom_username_validators = [ASCIIUsernameValidator()]
|
Reference in New Issue
Block a user