diff --git a/files/helpers/const.py b/files/helpers/const.py index 57cd3a5be..55caf69ec 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -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}' diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index 553ad1b21..b6d0e00f6 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -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, } diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 4f68ca1de..3e576d0c2 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -50,7 +50,7 @@ emoji_regex3 = re.compile(f'(?(.+?)<\/a>', flags=re.A) snappy_youtube_regex = re.compile('Email - + @@ -27,4 +27,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/files/templates/lost_2fa.html b/files/templates/lost_2fa.html index 96d9ad553..d3252dd85 100644 --- a/files/templates/lost_2fa.html +++ b/files/templates/lost_2fa.html @@ -24,7 +24,7 @@ - + @@ -32,4 +32,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/files/templates/settings_security.html b/files/templates/settings_security.html index 1a64460ff..afa629757 100644 --- a/files/templates/settings_security.html +++ b/files/templates/settings_security.html @@ -25,7 +25,7 @@
+ aria-describedby="new_email" type="email" pattern='{{EMAIL_REGEX_PATTERN}}' name="new_email" required> {% if v.email and not v.is_activated %}
Email not verified. You will not be able to recover your account with this email until you verify it. Verify now.
{% elif not v.email %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 05185ffa6..78cb8581e 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -94,7 +94,7 @@ (optional) + aria-describedby="emailHelpRegister" type="email" pattern='{{EMAIL_REGEX_PATTERN}}' name="email" readonly onfocus="if (this.hasAttribute('readonly')) {this.removeAttribute('readonly');this.blur();this.focus()}">