1
0
forked from arti/doors

2 Commits

Author SHA1 Message Date
dos4dev
eb16e01f79 Add post "/info/<user_id>" endpoint to save new card key. 2020-10-11 22:31:30 +03:00
Arti Zirk
7fa907699d Add db init instructions 2020-10-08 19:18:10 +03:00
2 changed files with 10 additions and 1 deletions

View File

@@ -9,7 +9,8 @@
## Initialize database
source venv/bin/activate
curl http://172.21.43.1:5000/user > ad.json
python3 -m kdoorweb initdb
## Run dev server

View File

@@ -138,6 +138,14 @@ def info(db, user_id):
return {**user, "keycards": keycards}
@app.post("/info/<user_id>")
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):