unify email regex

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-10-19 12:39:03 +02:00
parent d91827028b
commit 9efc0f0a68
7 changed files with 11 additions and 8 deletions

View File

@ -1239,3 +1239,5 @@ forced_hats = {
"is_suspended": ("Behind Bars", "This user is banned and needs to do better!"),
"agendaposter": ("Egg_irl", "This user is getting in touch with xir identity!")
}
EMAIL_REGEX_PATTERN = '[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{2,63}\.[A-Za-z]{2,63}'

View File

@ -48,5 +48,6 @@ def inject_constants():
"KOFI_TOKEN":KOFI_TOKEN, "KOFI_LINK":KOFI_LINK,
"approved_embed_hosts":approved_embed_hosts,
"site_settings":app.config['SETTINGS'],
"EMAIL":EMAIL, "calc_users": calc_users, "TELEGRAM_LINK": TELEGRAM_LINK
"EMAIL":EMAIL, "calc_users":calc_users, "TELEGRAM_LINK":TELEGRAM_LINK,
"EMAIL_REGEX_PATTERN":EMAIL_REGEX_PATTERN,
}

View File

@ -50,7 +50,7 @@ emoji_regex3 = re.compile(f'(?<!"):([!@{valid_username_chars}]{{1,35}}?):', flag
snappy_url_regex = re.compile('<a href="(https?:\/\/.+?)".*?>(.+?)<\/a>', flags=re.A)
snappy_youtube_regex = re.compile('<lite-youtube videoid="(.+?)" params="autoplay=1', flags=re.A)
email_regex = re.compile('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}', flags=re.A|re.I)
email_regex = re.compile(EMAIL_REGEX_PATTERN, flags=re.A)
utm_regex = re.compile('utm_[0-z]+=[0-z_]+&', flags=re.A)
utm_regex2 = re.compile('[?&]utm_[0-z]+=[0-z_]+', flags=re.A)

View File

@ -19,7 +19,7 @@
<label for="email" class="mt-3">Email</label>
<input type="email" pattern='([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+' autocomplete="off" class="form-control" id="password" aria-describedby="passwordHelp" name="email" required>
<input type="email" pattern='{{EMAIL_REGEX_PATTERN}}' autocomplete="off" class="form-control" id="password" aria-describedby="passwordHelp" name="email" required>
<input autocomplete="off" class="btn btn-primary login w-100 mt-3" type="submit" onclick="disable(this)" value="Send recovery link">
@ -27,4 +27,4 @@
</div>
{% endblock %}
{% endblock %}

View File

@ -24,7 +24,7 @@
<label for="email" class="mt-3">Email</label>
<input autocomplete="off" class="form-control" id="password" type="email" pattern='([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+' name="email" required=""{% if v %} value="{{v.email}}" disabled{% endif %}>
<input autocomplete="off" class="form-control" id="password" type="email" pattern='{{EMAIL_REGEX_PATTERN}}' name="email" required=""{% if v %} value="{{v.email}}" disabled{% endif %}>
<input autocomplete="off" class="btn btn-primary login w-100 mt-3" type="submit" onclick="disable(this)" value="Send recovery link">
@ -32,4 +32,4 @@
</div>
{% endblock %}
{% endblock %}

View File

@ -25,7 +25,7 @@
<label for="new-email" class="w-lg-25">Email</label>
<div class="w-lg-100">
<input autocomplete="off" class="form-control" id="new_email" {% if v.email %}placeholder="{{v.email}}"{% else %}placeholder="Your email"{% endif %}
aria-describedby="new_email" type="email" pattern='([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+' name="new_email" required>
aria-describedby="new_email" type="email" pattern='{{EMAIL_REGEX_PATTERN}}' name="new_email" required>
{% if v.email and not v.is_activated %}
<div class="text-danger text-small mt-1" id="email-verify-text">Email not verified. You will not be able to recover your account with this email until you verify it. <u><a role="button" onclick="post_toast(this,'/verify_email');emailVerifyText()"class="text-danger">Verify now.</a></u></div>
{% elif not v.email %}

View File

@ -94,7 +94,7 @@
<small class="d-inline-block text-muted ml-1">(optional)</small>
<input style="background-color: var(--gray-800)" autocomplete="off" class="form-control" id="email-register"
aria-describedby="emailHelpRegister" type="email" pattern='([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+' name="email" readonly onfocus="if (this.hasAttribute('readonly')) {this.removeAttribute('readonly');this.blur();this.focus()}">
aria-describedby="emailHelpRegister" type="email" pattern='{{EMAIL_REGEX_PATTERN}}' name="email" readonly onfocus="if (this.hasAttribute('readonly')) {this.removeAttribute('readonly');this.blur();this.focus()}">
<label for="password-register" class="mt-3">Password</label>