diff options
author | Jani Peter Karhunen <jkarhun2@local> | 2023-11-25 03:32:29 +0200 |
---|---|---|
committer | Jani Peter Karhunen <jkarhun2@local> | 2023-11-25 03:32:29 +0200 |
commit | d2de3ae10b6f5314bd4b8243218212d2004f35b0 (patch) | |
tree | 2ab448e0c2ec361478851dbcb43bcd176d17b584 /routes/set/nick.py | |
parent | c059696450d301b99956d643c21b0e46b4fc39dc (diff) |
MEGA Commit. Rework of routing. Visuals. Answer analysis and much more.
Diffstat (limited to 'routes/set/nick.py')
-rw-r--r-- | routes/set/nick.py | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/routes/set/nick.py b/routes/set/nick.py deleted file mode 100644 index 67ddeea..0000000 --- a/routes/set/nick.py +++ /dev/null @@ -1,28 +0,0 @@ -from app import app -from flask import render_template, session, request, redirect -import db_actions as D - - -@app.route("/set/nick",methods=["POST"]) -def new_nick(): - nick = request.form["nick"] - if "id" in session.keys(): - msg = "You already have a nick." - elif D.user_exists(nick): - msg = "Nick is already reserved." - elif msg := invalid_nick(nick): - pass - else: - session["id"] = D.user_new(nick) - return redirect("/") - session["alert"]="Nick in not created: "+msg - return redirect("/#nick") - - -def invalid_nick(nick): - if len(nick)<4: - return "Nick is too short" - if not nick.isalnum(): - return "Only letters and numbers are allowed" - return 0 -
\ No newline at end of file |