From 095f39d7b4e4346447531f6a1a0b7568c1a221ee Mon Sep 17 00:00:00 2001 From: Patrick Sulzle Date: Wed, 16 Mar 2022 17:07:05 +0100 Subject: [PATCH] bughunting voorbij. in functie login een , i.p.v. een : --- frontend/groclist.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/groclist.py b/frontend/groclist.py index f1a5bad..71ab2b0 100644 --- a/frontend/groclist.py +++ b/frontend/groclist.py @@ -1,5 +1,5 @@ import pymongo -from flask import Flask, request, render_template, redirect, url_for +from flask import Flask, request, render_template, redirect, url_for, abort # initialize connection to database app = Flask(__name__) @@ -22,8 +22,8 @@ def login(): if request.method == "POST": username = request.form["username"] password = request.form["password"] - if db.user_cred.find_one({"username": username, "password": password}): - auth_user_id = db.user_cred.find_one({"username": username},{"uuid", 1}) + if db.user_cred.find_one({"username": username, "password": password}): + 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"]) @@ -36,7 +36,12 @@ def login(): @app.route("/welcome/", methods=['GET']) def welcome(id): print("Hello: ", id) - + +@app.errorhandler(404) +def not_found(error): + app.logger.info(error) + return render_template("404.html"), 404 + # start server with run method if __name__ == "__main__": - app.run(debug=True) \ No newline at end of file + app.run(debug=True)