raise username length cap
This commit is contained in:
@@ -46,10 +46,12 @@ def create_session(user_id, temporary=False):
|
|||||||
})
|
})
|
||||||
|
|
||||||
def parse_username(username: str) -> Tuple[str, str]:
|
def parse_username(username: str) -> Tuple[str, str]:
|
||||||
|
"""first is the unmodified name/display name, second is username"""
|
||||||
if len(username) < 3:
|
if len(username) < 3:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
invalid_regex = r'[^a-zA-Z0-9_-]'
|
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:
|
def is_password_valid(password: str) -> bool:
|
||||||
return re.match(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}$', password) is not None
|
return re.match(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}$', password) is not None
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Please read the rules etc. stub
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<form class="plank primary-bg full-width" method="POST">
|
<form class="plank primary-bg full-width" method="POST">
|
||||||
<label for="username">Username</label>
|
<label for="username">Username</label>
|
||||||
<input type="text" id="username" name="username" pattern="[a-zA-Z0-9_\-]{3,20}" title="3-20 characters. Only upper and lowercase letters, digits, hyphens, and underscores" autocomplete="username" required>
|
<input type="text" id="username" name="username" pattern="[a-zA-Z0-9_\-]{3,24}" title="3-24 characters. Only upper and lowercase letters, digits, hyphens, and underscores" autocomplete="username" required>
|
||||||
<label for="password">Create password</label>
|
<label for="password">Create password</label>
|
||||||
<input type="password" id="password" name="password" pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}" title="10+ chars with: 1 uppercase, 1 lowercase, 1 number, 1 special char, and no spaces" autocomplete="new-password" required>
|
<input type="password" id="password" name="password" pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}" title="10+ chars with: 1 uppercase, 1 lowercase, 1 number, 1 special char, and no spaces" autocomplete="new-password" required>
|
||||||
<label for="password2">Confirm password</label>
|
<label for="password2">Confirm password</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user