This commit is contained in:
Aevann1 2021-08-11 21:46:57 +02:00
parent d4c67cc609
commit df357ccddb
2 changed files with 45 additions and 3 deletions

View file

@ -165,7 +165,8 @@ def changelogsub(v):
@validate_formkey
def namecolor(v):
color = str(request.form.get("color", "")).strip()
if color not in ['ff66ac','805ad5','62ca56','38a169','80ffff','2a96f3','eb4963','ff0000','f39731','30409f','3e98a7','e4432d','7b9ae4','ec72de','7f8fa6', 'f8db58']: abort(400)
if color.startswith('#'): color = color[1:]
if len(color) != 6: return render_template("settings_security.html", v=v, error="Invalid color code")
v.namecolor = color
g.db.add(v)
return redirect("/settings/profile")
@ -175,7 +176,8 @@ def namecolor(v):
@validate_formkey
def themecolor(v):
themecolor = str(request.form.get("themecolor", "")).strip()
if themecolor not in ['ff66ac','805ad5','62ca56','38a169','80ffff','2a96f3','eb4963','ff0000','f39731','30409f','3e98a7','e4432d','7b9ae4','ec72de','7f8fa6', 'f8db58']: abort(400)
if themecolor.startswith('#'): themecolor = themecolor[1:]
if len(themecolor) != 6: return render_template("settings_security.html", v=v, error="Invalid color code")
v.themecolor = themecolor
g.db.add(v)
return redirect("/settings/profile")
@ -185,7 +187,8 @@ def themecolor(v):
@validate_formkey
def titlecolor(v):
titlecolor = str(request.form.get("titlecolor", "")).strip()
if titlecolor not in ['ff66ac','805ad5','62ca56','38a169','80ffff','2a96f3','eb4963','ff0000','f39731','30409f','3e98a7','e4432d','7b9ae4','ec72de','7f8fa6', 'f8db58']: abort(400)
if titlecolor.startswith('#'): titlecolor = titlecolor[1:]
if len(titlecolor) != 6: return render_template("settings_security.html", v=v, error="Invalid color code")
v.titlecolor = titlecolor
g.db.add(v)
return redirect("/settings/profile")