From 70b247c640b506e407bc7f3daa48a6662a893cad Mon Sep 17 00:00:00 2001 From: Tiia Soikkeli Date: Tue, 12 Dec 2023 02:51:56 +0200 Subject: Adding nick resetting functionality. --- routes/base.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'routes') 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"]=="": -- cgit v1.2.3