Esempio n. 1
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.', 'info')
        return redirect(url_for('auth.login'))
    return render_template('reset_request.html', title='Reset Password', form=form)
Esempio n. 2
0
def reset_request():
    if current_user.is_authenticated:
        return redirect(url_for("posts.home"))
    form = ResetRequestForm()
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        send_reset_email(user)
        flash("Email with reset password instructions is sent", "info")
        return redirect(url_for("auth.login"))
    return render_template("reset_request.html", form=form)
Esempio n. 3
0
def password_reset_request():
    form = PasswordResetRequestForm()
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        if user:
            token = user.generate_reset_token()
            send_reset_email(user=user, token=token)
        flash('Instruction with password reset has been sent to you', 'danger')
        return redirect(url_for('auth.login'))

    return render_template('account/password_reset_request.html', form=form)
Esempio n. 4
0
def reset_request():
    if current_user.is_authenticated:
        return redirect(url_for('posts.home'))

    form = ResetPassword()
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        send_reset_email(user)

        flash("The Email has been sent! Please check your inbox and reset your password.", 'info')
        redirect (url_for('auth.login'))
    return render_template('reset_request.html', form = form)
Esempio n. 5
0
def reset_password():
    if current_user.is_authenticated:
        return redirect(url_for('posts.home'))

    form = RequestForm()
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        send_reset_email(user)
        flash(
            'An email has been send to your email, please follow the instruction',
            'info')
        return redirect(url_for('auth.login'))
    return render_template('reset_request.html', form=form)
Esempio n. 6
0
def reset_password_request():
    if current_user.is_authenticated:
        return redirect(url_for('main.index'))
    form = RequestResetForm()
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        if user:
            send_reset_email(user)
        flash('Check your email for the instructions to reset your password',
              'info')
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='Reset Password',
                           form=form)