master
Aevann1 2022-02-26 17:22:18 +02:00
parent eb5192fb9c
commit bde9531ff3
4 changed files with 7 additions and 7 deletions

View File

@ -666,4 +666,7 @@ christian_emojis = (':#marseyjesus:',':#marseyimmaculate:',':#marseymothermary:'
db = db_session() db = db_session()
marseys_const = [x[0] for x in db.query(Marsey.name).all()] + ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark'] marseys_const = [x[0] for x in db.query(Marsey.name).all()] + ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark']
db.close() db.close()
if SITE == 'PCM': valid_username_regex = re.compile("^[a-zA-Z0-9_\-А-я]{3,25}$")
else: valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$")

View File

@ -181,7 +181,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
tag["target"] = "_blank" tag["target"] = "_blank"
tag["rel"] = "nofollow noopener noreferrer" tag["rel"] = "nofollow noopener noreferrer"
if re.match("https?://\S+", str(tag.string), flags=re.A): if re.fullmatch("https?://\S+", str(tag.string), flags=re.A):
try: tag.string = tag["href"] try: tag.string = tag["href"]
except: tag.string = "" except: tag.string = ""

View File

@ -4,10 +4,8 @@ from files.__main__ import app, limiter
from files.helpers.const import * from files.helpers.const import *
import requests import requests
valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$")
valid_password_regex = re.compile("^.{8,100}$") valid_password_regex = re.compile("^.{8,100}$")
@app.get("/login") @app.get("/login")
@auth_desired @auth_desired
def login_get(v): def login_get(v):

View File

@ -14,7 +14,6 @@ from files.helpers.discord import add_role
from shutil import copyfile from shutil import copyfile
import requests import requests
valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$")
valid_password_regex = re.compile("^.{8,100}$") valid_password_regex = re.compile("^.{8,100}$")
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip() YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
@ -533,7 +532,7 @@ def settings_security_post(v):
if request.values.get("new_password") != request.values.get("cnf_password"): if request.values.get("new_password") != request.values.get("cnf_password"):
return render_template("settings_security.html", v=v, error="Passwords do not match.") return render_template("settings_security.html", v=v, error="Passwords do not match.")
if not re.match(valid_password_regex, request.values.get("new_password")): if not re.fullmatch(valid_password_regex, request.values.get("new_password")):
return render_template("settings_security.html", v=v, error="Password must be between 8 and 100 characters.") return render_template("settings_security.html", v=v, error="Password must be between 8 and 100 characters.")
if not v.verifyPass(request.values.get("old_password")): if not v.verifyPass(request.values.get("old_password")):
@ -860,7 +859,7 @@ def settings_name_change(v):
v=v, v=v,
error="You didn't change anything") error="You didn't change anything")
if not re.match(valid_username_regex, new_name): if not re.fullmatch(valid_username_regex, new_name):
return render_template("settings_profile.html", return render_template("settings_profile.html",
v=v, v=v,
error="This isn't a valid username.") error="This isn't a valid username.")