fdfd
This commit is contained in:
parent
d4c67cc609
commit
df357ccddb
2 changed files with 45 additions and 3 deletions
|
@ -165,7 +165,8 @@ def changelogsub(v):
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def namecolor(v):
|
def namecolor(v):
|
||||||
color = str(request.form.get("color", "")).strip()
|
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
|
v.namecolor = color
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
return redirect("/settings/profile")
|
return redirect("/settings/profile")
|
||||||
|
@ -175,7 +176,8 @@ def namecolor(v):
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def themecolor(v):
|
def themecolor(v):
|
||||||
themecolor = str(request.form.get("themecolor", "")).strip()
|
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
|
v.themecolor = themecolor
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
return redirect("/settings/profile")
|
return redirect("/settings/profile")
|
||||||
|
@ -185,7 +187,8 @@ def themecolor(v):
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def titlecolor(v):
|
def titlecolor(v):
|
||||||
titlecolor = str(request.form.get("titlecolor", "")).strip()
|
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
|
v.titlecolor = titlecolor
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
return redirect("/settings/profile")
|
return redirect("/settings/profile")
|
||||||
|
|
|
@ -62,7 +62,20 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p class="text-small mb-2">Or type a color code:</p>
|
||||||
|
|
||||||
|
<div class="d-flex">
|
||||||
|
|
||||||
|
<form action="/settings/themecolor" id="color-code-form" method="post">
|
||||||
|
<input type="hidden" name="formkey" value="{{ v.formkey }}">
|
||||||
|
|
||||||
|
<input class="form-control" type="text" name="themecolor" id="color-code" value="{% if v.themecolor %}{{v.themecolor}}{% endif %}">
|
||||||
|
<label class="btn btn-secondary text-capitalize mr-2 mt-2 mb-0">Update<input type="text" for="color-code" onclick="form.submit()" hidden=""></label>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -312,6 +325,19 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p class="text-small mb-2">Or type a color code:</p>
|
||||||
|
|
||||||
|
<div class="d-flex">
|
||||||
|
|
||||||
|
<form action="/settings/namecolor" id="color-code-form" method="post">
|
||||||
|
<input type="hidden" name="formkey" value="{{ v.formkey }}">
|
||||||
|
|
||||||
|
<input class="form-control" type="text" name="color" id="color-code" value="{% if v.namecolor %}{{v.namecolor}}{% endif %}">
|
||||||
|
<label class="btn btn-secondary text-capitalize mr-2 mt-2 mb-0">Update<input type="text" for="color-code" onclick="form.submit()" hidden=""></label>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -363,6 +389,19 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p class="text-small mb-2">Or type a color code:</p>
|
||||||
|
|
||||||
|
<div class="d-flex">
|
||||||
|
|
||||||
|
<form action="/settings/titlecolor" id="color-code-form" method="post">
|
||||||
|
<input type="hidden" name="formkey" value="{{ v.formkey }}">
|
||||||
|
|
||||||
|
<input class="form-control" type="text" name="titlecolor" id="color-code" value="{% if v.titlecolor %}{{v.titlecolor}}{% endif %}">
|
||||||
|
<label class="btn btn-secondary text-capitalize mr-2 mt-2 mb-0">Update<input type="text" for="color-code" onclick="form.submit()" hidden=""></label>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="body d-lg-flex border-bottom">
|
<div class="body d-lg-flex border-bottom">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue