diff --git a/backend/add_user.py b/backend/add_user.py index 255cc81..fbe1796 100644 --- a/backend/add_user.py +++ b/backend/add_user.py @@ -19,9 +19,10 @@ email = input("Email-adres: ") full_name = input("Volledige naam: ") list_id = "" -user_cred = {"username": username, "password": password, "uuid": uuid} +user_cred = {"username": username, "password": password, "uuid": uuid} user_info = {"uuid":uuid, "email": email, "name": full_name ,"listid": list_id} - +stores_list = {"stores_name": ["Jumbo","AH","Boons","Aldi","Lidl"]} +item_list = {"stores_name" : 1} if db.user_cred.find_one({"username": username}): print("Username already exists\n") @@ -31,3 +32,4 @@ else: info_record = db.user_info.insert_one(user_info) print("User created") +stores_record = db.stores_list.insert_many(stores_list) diff --git a/frontend/groclist.py b/frontend/groclist.py index 71ab2b0..f4815dd 100644 --- a/frontend/groclist.py +++ b/frontend/groclist.py @@ -26,16 +26,17 @@ def login(): auth_user_id = db.user_cred.find_one({"username": username},{"uuid": 1}) if auth_user_id: app.logger.info(auth_user_id) - return render_template("welcome.html", id=auth_user_id["uuid"]) + return redirect(url_for("list", id=auth_user_id["uuid"])) + #return render_template("list.html", username=username) else: - return render_template("404.html") + return redirect(url_for("not_found")) else: error = "Usernaam of wachtwoord onbekend, probeer opnieuw" return render_template("login.html", error=error) -@app.route("/welcome/", methods=['GET']) -def welcome(id): - print("Hello: ", id) +@app.route("/list/", methods=['GET']) +def list(id): + return render_template("list.html", id=id) @app.errorhandler(404) def not_found(error): diff --git a/frontend/templates/welcome.html b/frontend/templates/list.html similarity index 66% rename from frontend/templates/welcome.html rename to frontend/templates/list.html index dd1c619..eb99e7e 100644 --- a/frontend/templates/welcome.html +++ b/frontend/templates/list.html @@ -1,14 +1,15 @@ - Welcome to groclist + Items on your list

Welcome to GrocList


- Hello userid: {{ userid }} + Hello {{ id }} +

Click List to view shopping list

Click here to go home.