Bugfix: reset password

This commit is contained in:
Vivek Santayana 2022-08-11 16:05:28 +01:00
parent 70883db5ad
commit 730a75c44d

View File

@ -117,7 +117,8 @@ def _reset():
user.clear_reset_tokens() user.clear_reset_tokens()
if request.args.get('verification') == verification_token: if request.args.get('verification') == verification_token:
form = UpdatePassword() form = UpdatePassword()
return render_template('/admin/auth/update-password.html', form=form, user=user.id) session['user'] = user.id
return render_template('/admin/auth/update-password.html', form=form)
flash('The verification of your password reset request failed and the token has been invalidated. Please make a new reset password request.', 'error') flash('The verification of your password reset request failed and the token has been invalidated. Please make a new reset password request.', 'error')
return render_template('/admin/auth/reset.html', form=form) return render_template('/admin/auth/reset.html', form=form)
@ -126,7 +127,7 @@ def _reset():
def _update_password(): def _update_password():
form = UpdatePassword() form = UpdatePassword()
if form.validate_on_submit(): if form.validate_on_submit():
user = request.form.get('user') user = session.pop('user')
user = User.query.filter_by(id=user).first() user = User.query.filter_by(id=user).first()
user.update(password=request.form.get('password')) user.update(password=request.form.get('password'))
session['remembered_username'] = user.get_username() session['remembered_username'] = user.get_username()