From e75e08785770be06b65330ab68fd4e07a876d978 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 27 Jan 2019 20:24:19 +0100 Subject: [PATCH] Fix change password bug --- webserver.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/webserver.py b/webserver.py index 1f17ef97..c8f09661 100644 --- a/webserver.py +++ b/webserver.py @@ -182,13 +182,12 @@ def page_password(): return render_template("password.html") elif request.method == "POST": new_password = request.form.get("new", "") - user = fl_g.session.query(db.Royal).filter_by(id=fl_g.user_id).one() + user = fl_g.session.query(db.Royal).filter_by(id=fl_g.user.id).one() if user.password is None: - user.password = bcrypt.hashpw(bytes(new_password, encoding="utf8"), bcrypt.gensalt()) user.fiorygi += 1 - fl_g.session.commit() - return redirect(url_for("page_main")) - abort(403) + user.password = bcrypt.hashpw(bytes(new_password, encoding="utf8"), bcrypt.gensalt()) + fl_g.session.commit() + return redirect(url_for("page_main")) @app.route("/editprofile", methods=["GET", "POST"])