specify the type of color code we want

master
Aevann1 2022-09-11 12:04:21 +02:00
parent 691857b805
commit ce0b141325
2 changed files with 8 additions and 8 deletions

View File

@ -315,7 +315,7 @@ def namecolor(v):
if color.startswith('#'): color = color[1:] if color.startswith('#'): color = color[1:]
if not color_regex.fullmatch(color): if not color_regex.fullmatch(color):
return render_template("settings_profile.html", v=v, error="Invalid color code") return render_template("settings_profile.html", v=v, error="Invalid color hex code")
v.namecolor = color v.namecolor = color
g.db.add(v) g.db.add(v)
@ -331,7 +331,7 @@ def themecolor(v):
if themecolor.startswith('#'): themecolor = themecolor[1:] if themecolor.startswith('#'): themecolor = themecolor[1:]
if not color_regex.fullmatch(themecolor): if not color_regex.fullmatch(themecolor):
return render_template("settings_profile.html", v=v, error="Invalid color code") return render_template("settings_profile.html", v=v, error="Invalid color hex code")
v.themecolor = themecolor v.themecolor = themecolor
g.db.add(v) g.db.add(v)
@ -384,7 +384,7 @@ def titlecolor(v):
if titlecolor.startswith('#'): titlecolor = titlecolor[1:] if titlecolor.startswith('#'): titlecolor = titlecolor[1:]
if not color_regex.fullmatch(titlecolor): if not color_regex.fullmatch(titlecolor):
return render_template("settings_profile.html", v=v, error="Invalid color code") return render_template("settings_profile.html", v=v, error="Invalid color hex code")
v.titlecolor = titlecolor v.titlecolor = titlecolor
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/profile")
@ -396,7 +396,7 @@ def titlecolor(v):
def verifiedcolor(v): def verifiedcolor(v):
verifiedcolor = str(request.values.get("verifiedcolor", "")).strip() verifiedcolor = str(request.values.get("verifiedcolor", "")).strip()
if verifiedcolor.startswith('#'): verifiedcolor = verifiedcolor[1:] if verifiedcolor.startswith('#'): verifiedcolor = verifiedcolor[1:]
if len(verifiedcolor) != 6: return render_template("settings_profile.html", v=v, error="Invalid color code") if len(verifiedcolor) != 6: return render_template("settings_profile.html", v=v, error="Invalid color hex code")
v.verifiedcolor = verifiedcolor v.verifiedcolor = verifiedcolor
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/profile")

View File

@ -168,7 +168,7 @@
</div> </div>
<p class="text-small mb-2">Or type a color code:</p> <p class="text-small mb-2">Or type a color hex code:</p>
<div class="d-flex"> <div class="d-flex">
<form action="/settings/themecolor" id="color-code-form" method="post"> <form action="/settings/themecolor" id="color-code-form" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}"> <input type="hidden" name="formkey" value="{{v.formkey}}">
@ -451,7 +451,7 @@
</div> </div>
<p class="text-small mb-2">Or type a color code:</p> <p class="text-small mb-2">Or type a color hex code:</p>
<div class="d-flex"> <div class="d-flex">
<form action="/settings/namecolor" id="color-code-form" method="post"> <form action="/settings/namecolor" id="color-code-form" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}"> <input type="hidden" name="formkey" value="{{v.formkey}}">
@ -528,7 +528,7 @@
<p class="text-small mb-2">Or type a color code:</p> <p class="text-small mb-2">Or type a color hex code:</p>
<div class="d-flex"> <div class="d-flex">
<form action="/settings/titlecolor" id="color-code-form" method="post"> <form action="/settings/titlecolor" id="color-code-form" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}"> <input type="hidden" name="formkey" value="{{v.formkey}}">
@ -571,7 +571,7 @@
</div> </div>
<p class="text-small mb-2">Or type a color code:</p> <p class="text-small mb-2">Or type a color hex code:</p>
<div class="d-flex"> <div class="d-flex">
<form action="/settings/verifiedcolor" id="color-code-form" method="post"> <form action="/settings/verifiedcolor" id="color-code-form" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}"> <input type="hidden" name="formkey" value="{{v.formkey}}">