longer emails, longer passwords, longer reset codes
This commit is contained in:
parent
7738ac2779
commit
15cb3fb5bf
3 changed files with 14 additions and 8 deletions
|
|
@ -5,13 +5,18 @@ from django.core.validators import MaxLengthValidator
|
|||
import app.models
|
||||
app.models.load_config()
|
||||
|
||||
NEW_USERNAME_LENGTH = 255
|
||||
NEW_LENGTH = {
|
||||
'username': 255,
|
||||
'email': 255,
|
||||
'password': 255,
|
||||
}
|
||||
|
||||
def monkey_patch_username():
|
||||
username = User._meta.get_field("username")
|
||||
username.max_length = NEW_USERNAME_LENGTH
|
||||
for v in username.validators:
|
||||
if isinstance(v, MaxLengthValidator):
|
||||
v.limit_value = NEW_USERNAME_LENGTH
|
||||
for field in NEW_LENGTH:
|
||||
f= User._meta.get_field(field)
|
||||
f.max_length = NEW_LENGTH[field]
|
||||
for v in f.validators:
|
||||
if isinstance(v, MaxLengthValidator):
|
||||
v.limit_value = NEW_LENGTH[field]
|
||||
|
||||
monkey_patch_username()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue