bughunting voorbij. in functie login een , i.p.v. een :
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import pymongo
|
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
|
# initialize connection to database
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@@ -23,7 +23,7 @@ def login():
|
|||||||
username = request.form["username"]
|
username = request.form["username"]
|
||||||
password = request.form["password"]
|
password = request.form["password"]
|
||||||
if db.user_cred.find_one({"username": username, "password": password}):
|
if db.user_cred.find_one({"username": username, "password": password}):
|
||||||
auth_user_id = db.user_cred.find_one({"username": username},{"uuid", 1})
|
auth_user_id = db.user_cred.find_one({"username": username},{"uuid": 1})
|
||||||
if auth_user_id:
|
if auth_user_id:
|
||||||
app.logger.info(auth_user_id)
|
app.logger.info(auth_user_id)
|
||||||
return render_template("welcome.html", id=auth_user_id["uuid"])
|
return render_template("welcome.html", id=auth_user_id["uuid"])
|
||||||
@@ -37,6 +37,11 @@ def login():
|
|||||||
def welcome(id):
|
def welcome(id):
|
||||||
print("Hello: ", 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
|
# start server with run method
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
Reference in New Issue
Block a user