summaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
authorTiia Soikkeli <tsoikkel@local>2023-12-12 02:51:56 +0200
committerTiia Soikkeli <tsoikkel@local>2023-12-12 02:51:56 +0200
commit70b247c640b506e407bc7f3daa48a6662a893cad (patch)
tree446209951815bf994359243dbfc759f484e1f770 /routes
parent84d1277c408038ab0df6179659c68ac7f08a098f (diff)
Adding nick resetting functionality.
Diffstat (limited to 'routes')
-rw-r--r--routes/base.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/routes/base.py b/routes/base.py
index 52db258..1af8cf7 100644
--- a/routes/base.py
+++ b/routes/base.py
@@ -23,12 +23,22 @@ def info():
alert=get_alert()
)
+@app.route("/pages/nick_reset.html")
+def nick_reset():
+ if "id" in session:
+ return render_template(
+ "nick_reset.html",
+ caller="info",
+ nick=get_nick()
+ )
+ return redirect("/")
+
@app.route("/set/nick",methods=["POST"])
def new_nick():
next = "/#"+request.form["caller"] if "caller" in request.form else "/"
if csrf_check():
return redirect(next)
- if "id" in session.keys():
+ if "id" in session.keys() and "reset" not in request.form:
session["alert"]="Sinulla on jo nimimerkki. Käytä sitä."
return redirect(next)
if "nick" not in request.form or request.form["nick"]=="":