コード例 #1
0
def request_token():
    form = RequestResetForm()
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        send_email(user)
        flash('Email sent successfully to reset password. Please check it.', 'success')
        return redirect(url_for('users.request_token'))
    return render_template('request_token.html', title='Reset Password Request', form=form)
コード例 #2
0
def reset_request():
	if current_user.is_authenticated:
		return redirect(url_for('home'))
	form = RequestResetForm()
	if form.validate_on_submit():
		user = User.query.filter_by(email = form.email.data).first()
		send_reset_email(user)
		flash('An email has been sent to reset your Password!', 'info')
		return redirect(url_for('login'))
	return render_template('reset_request.html', title = 'Reset Password', form = form)
コード例 #3
0
def reset_request():
    if current_user.is_authenticated:
        return redirect(url_for('main.home'))
    form = RequestResetForm()
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        send_reset_email(user)
        flash(
            'An email has been sent with instructions to reset your password',
            'success')
        return redirect(url_for('main.home'))
    return render_template('reset_request.html',
                           title="Reset Password",
                           form=form)
コード例 #4
0
def reset_request():
    if current_user.is_authenticated:
        return redirect(url_for("main.home"))
    posts = Post.query.all()
    form = RequestResetForm()
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        send_reset_email(user)
        flash(
            "An email has been sent with instructions on your password reset",
            "info")
        return redirect(url_for("users.login"))
    return render_template("reset_request.html",
                           title="Reset Password",
                           form=form,
                           posts=posts)