raise username length cap

This commit is contained in:
2026-04-17 10:55:04 +03:00
parent d2cdeaed1d
commit 68958e304b
2 changed files with 4 additions and 2 deletions

View File

@@ -46,10 +46,12 @@ def create_session(user_id, temporary=False):
})
def parse_username(username: str) -> Tuple[str, str]:
"""first is the unmodified name/display name, second is username"""
if len(username) < 3:
raise ValueError
invalid_regex = r'[^a-zA-Z0-9_-]'
return username, re.sub(invalid_regex, '_', username.lower())[:20]
return username, re.sub(invalid_regex, '_', username.lower())[:24]
def is_password_valid(password: str) -> bool:
return re.match(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}$', password) is not None