allow paypigs to have 1-letter and 2-letter names

pull/173/head
Aevann 2023-08-01 09:46:12 +03:00
parent 0900277226
commit 201eec7aa5
2 changed files with 7 additions and 1 deletions

View File

@ -7,6 +7,7 @@ from .config.const import *
NOT_IN_CODE_OR_LINKS = '(?!([^<]*<\/(code|pre|a)>|[^`\n]*`|(.|\n)*```))'
valid_username_regex = re.compile("^[\w\-]{3,25}$", flags=re.A)
valid_username_patron_regex = re.compile("^[\w\-]{1,25}$", flags=re.A)
mention_regex = re.compile('(?<![/\w])@([\w\-]{1,30})' + NOT_IN_CODE_OR_LINKS, flags=re.A)
group_mention_regex = re.compile('(?<![/\w])!([\w\-]{3,25})' + NOT_IN_CODE_OR_LINKS, flags=re.A|re.I)

View File

@ -743,7 +743,12 @@ def settings_name_change(v):
v=v,
error="You didn't change anything")
if not valid_username_regex.fullmatch(new_name):
if v.patron:
used_regex = valid_username_patron_regex
else:
used_regex = valid_username_regex
if not used_regex.fullmatch(new_name):
return render_template("settings/personal.html",
v=v,
error="This isn't a valid username.")