summaryrefslogtreecommitdiff
path: root/nick.py
diff options
context:
space:
mode:
authorSenni Heidari <sheidar2@local>2023-11-21 11:36:12 +0200
committerSenni Heidari <sheidar2@local>2023-11-21 11:36:12 +0200
commitb868d0ba58384fce5a9a45ae153dee9815327d55 (patch)
tree2d73e810cad9eba76121f28b07eeb49bf3f9e573 /nick.py
parent2ebfcf29c84b84999b76ff13150ba5a13fd3cac1 (diff)
Update directory hierarchy
Diffstat (limited to 'nick.py')
-rw-r--r--nick.py28
1 files changed, 0 insertions, 28 deletions
diff --git a/nick.py b/nick.py
deleted file mode 100644
index f476d29..0000000
--- a/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("/new_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