forked from rDrama/rDrama
allow paypigs to have 1-letter and 2-letter names
parent
0900277226
commit
201eec7aa5
|
@ -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)
|
||||
|
|
|
@ -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.")
|
||||
|
|
Loading…
Reference in New Issue