1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Fix change password bug

This commit is contained in:
Steffo 2019-01-27 20:24:19 +01:00
parent ab0fa243f5
commit e75e087857

View file

@ -182,13 +182,12 @@ def page_password():
return render_template("password.html") return render_template("password.html")
elif request.method == "POST": elif request.method == "POST":
new_password = request.form.get("new", "") 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: if user.password is None:
user.password = bcrypt.hashpw(bytes(new_password, encoding="utf8"), bcrypt.gensalt())
user.fiorygi += 1 user.fiorygi += 1
fl_g.session.commit() user.password = bcrypt.hashpw(bytes(new_password, encoding="utf8"), bcrypt.gensalt())
return redirect(url_for("page_main")) fl_g.session.commit()
abort(403) return redirect(url_for("page_main"))
@app.route("/editprofile", methods=["GET", "POST"]) @app.route("/editprofile", methods=["GET", "POST"])