def reset_password_request(): if current_user.is_authenticated: return redirect(url_for('index')) form = ResetPasswordRequestForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() if user: send_password_reset_email(user) flash('Check your email for the instructions to reset your password') return redirect(url_for('login')) return render_template('reset_password_request.html', title='Reset Password', form=form)
def reset_password_request(): if current_user.is_authenticated: return redirect(url_for('home')) form = ResetPasswordRequestForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() if user: send_password_reset_email(user) flash( 'Please check your email for the instructions to reset your password', category='info') else: flash('Your email is not found in our sytem!', category='danger') return redirect(url_for('login')) return render_template('reset_password_request.html', form=form)
def reset_password_request(): if current_user.is_authenticated: return redirect(url_for("index")) form = ResetPasswordRequestForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() if user: send_password_reset_email(user) flash(_("Check your email")) return redirect(url_for("login")) return render_template("reset_password_request.html", form=form)
def requestResetPassword(): """Request admin reset password form""" if current_user.is_authenticated: return redirect(url_for('main.index')) form = RequestPasswordResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() if user: send_password_reset_email(user) flash('Check email for instructions to reset password') return redirect(url_for('main.login')) else: flash('Admin account not found') return render_template('requestPasswordReset.html', title='Request Password Reset', form=form)
def request_password_reset(): if current_user.is_authenticated: return redirect(url_for("main.index")) form = ResetPasswordRequestForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).one_or_none() if user: send_password_reset_email(user) flash( _("Check your email for the instructions to reset your password")) return redirect(url_for("main.login")) return render_template("form_generator.html", title=_("Request Password Reset"), form=form)