From eb16e01f79c48cdc78eadbfeb9bce2ea12b1e132 Mon Sep 17 00:00:00 2001 From: dos4dev Date: Sun, 11 Oct 2020 22:31:30 +0300 Subject: [PATCH] Add post "/info/" endpoint to save new card key. --- kdoorweb/kdoorweb/web.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kdoorweb/kdoorweb/web.py b/kdoorweb/kdoorweb/web.py index 81f6045..0b8145f 100644 --- a/kdoorweb/kdoorweb/web.py +++ b/kdoorweb/kdoorweb/web.py @@ -138,6 +138,14 @@ def info(db, user_id): return {**user, "keycards": keycards} +@app.post("/info/") +def add_key_card(db, user_id): + card_name = request.forms.get("name") + card_uid = request.forms.get("uid") + db.add_keycard(user_id, card_uid, card_name) + redirect("/info/" + user_id) + + @app.route("/log") @view("log.html") def log(db):