change pronouns required format from 1-5 to 2-5

master
Aevann1 2022-07-12 20:28:07 +02:00
parent b76ec57eb8
commit afa2f68804
3 changed files with 4 additions and 4 deletions

View File

@ -102,7 +102,7 @@ search_token_regex = re.compile('"([^"]*)"|(\S+)', flags=re.A)
git_regex = re.compile("ref: (refs/.+)", flags=re.A) git_regex = re.compile("ref: (refs/.+)", flags=re.A)
pronouns_regex = re.compile("[a-z]{1,5}/[a-z]{1,5}", flags=re.A) pronouns_regex = re.compile("[a-z]{2,5}/[a-z]{2,5}", flags=re.A)
def sub_matcher(match, upper=False): def sub_matcher(match, upper=False):
if match.group(0).startswith('<'): if match.group(0).startswith('<'):

View File

@ -892,7 +892,7 @@ def settings_pronouns_change(v):
return render_template("settings_profile.html", v=v, error="You didn't change anything") return render_template("settings_profile.html", v=v, error="You didn't change anything")
if not pronouns_regex.fullmatch(pronouns): if not pronouns_regex.fullmatch(pronouns):
return render_template("settings_profile.html", v=v, error="The pronouns you entered don't match the required format {1-5 characters}/{1-5 characters}") return render_template("settings_profile.html", v=v, error="The pronouns you entered don't match the required format {2-5 characters}/{2-5 characters}")
v.pronouns = pronouns v.pronouns = pronouns
g.db.add(v) g.db.add(v)

View File

@ -466,9 +466,9 @@
<div class="w-lg-100"> <div class="w-lg-100">
<form id="profile-settings" action="/settings/pronouns_change" method="post"> <form id="profile-settings" action="/settings/pronouns_change" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}"> <input type="hidden" name="formkey" value="{{v.formkey}}">
<input minlength=3 maxlength=11 pattern="[a-zA-Z]{1,5}/[a-zA-Z]{1,5}" autocomplete="off" id="pronounbody" type="text" name="pronouns" class="form-control" placeholder='Enter pronouns here' value="{% if v.pronouns %}{{v.pronouns}}{% endif %}"> <input minlength=3 maxlength=11 pattern="[a-zA-Z]{2,5}/[a-zA-Z]{2,5}" autocomplete="off" id="pronounbody" type="text" name="pronouns" class="form-control" placeholder='Enter pronouns here' value="{% if v.pronouns %}{{v.pronouns}}{% endif %}">
<div class="d-flex mt-2"> <div class="d-flex mt-2">
<small>{1-5 characters} / {1-5 characters}</small> <small>{2-5 characters} / {2-5 characters}</small>
<input autocomplete="off" class="btn btn-primary ml-auto" id="pronounsSave" type="submit" onclick="disable(this)" value="Change Pronouns"> <input autocomplete="off" class="btn btn-primary ml-auto" id="pronounsSave" type="submit" onclick="disable(this)" value="Change Pronouns">
</div> </div>
</form> </form>