def reset_user_password(user_id): user = User.by_id(user_id) form = RecoverSetForm() if form.validate_on_submit(): user.update_password(form.password.data) db.session.commit() flash(_('Password reset', username=user.email), 'success') return render_template('admin/reset_user_password.html', form=form, user=user)
def reset_user_password(id): form = RecoverSetForm() if form.validate_on_submit(): user = User.by_id(id) user.update_password(form.password.data) db.session.commit() flash( _('Password reset', username=user.realname), 'success') return redirect(url_for('admin.user_detail', id=id)) return render_template('admin/reset_user_password.html', form=form)
def recover_new_password(uuid): verify = EmailVerification.by_hash(uuid) if not verify or not (verify.is_import or verify.is_recover): return NotFound() user = verify.user form = RecoverSetForm() if form.validate_on_submit(): user.update_password(form.data['password']) db.session.delete(verify) db.session.commit() login_user(user) return redirect(url_for(".home")) return render_template("user/password_set.html", user=user, form=form, verify=verify)
def recover_new_password(uuid): verify = EmailVerification.by_hash(uuid) if not verify or not (verify.is_import or verify.is_recover): return render_template("errors/404.html", error_msg=_('infotext recover not possible')) user = verify.user form = RecoverSetForm() if form.validate_on_submit(): user.update_password(form.data['password']) db.session.delete(verify) db.session.commit() login_user(user) return redirect(url_for(".home")) return render_template("user/password_set.html", user=user, form=form, verify=verify)