disallow #21262c from being used as a name color or a flair color

remotes/1693045480750635534/spooky-22
Aevann1 2022-06-10 22:52:20 +02:00
parent 87ba1ba50e
commit 9fb33d064a
1 changed files with 4 additions and 2 deletions

View File

@ -351,9 +351,10 @@ def changelogsub(v):
@auth_required
def namecolor(v):
color = str(request.values.get("color", "")).strip()
color = request.values.get("color", "").strip().lower()
if color.startswith('#'): color = color[1:]
if len(color) != 6: return render_template("settings_security.html", v=v, error="Invalid color code")
if color == '21262c': return render_template("settings_security.html", v=v, error="This color is not allowed")
v.namecolor = color
g.db.add(v)
g.db.commit()
@ -420,9 +421,10 @@ def gumroad(v):
@auth_required
def titlecolor(v):
titlecolor = str(request.values.get("titlecolor", "")).strip()
titlecolor = request.values.get("titlecolor", "").strip().lower()
if titlecolor.startswith('#'): titlecolor = titlecolor[1:]
if len(titlecolor) != 6: return render_template("settings_profile.html", v=v, error="Invalid color code")
if titlecolor == '21262c': return render_template("settings_profile.html", v=v, error="This color is not allowed")
v.titlecolor = titlecolor
g.db.add(v)
g.db.commit()