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('users.login'))
    return render_template('reset_request.html', title='Reset Password', form=form)
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()
        if user is None:
            flash('Email Was not found in the Database','danger')
            return redirect(url_for('users.reset_request'))
        send_reset_email(user)
        flash('An Email has been sent with Reset Password Instruction','info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html', title = "Reset Password", form = form)
Beispiel #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(f'Reset password email was sent to {form.email.data}', 'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           form=form,
                           title='Reset Password',
                           num_registered=User.get_num_registered())
Beispiel #4
0
def reset_request():
    if current_user.is_authenticated:
        flash(f'You are already logged in.', 'success')
        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 to your mail.', 'success')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #5
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 instruction to reset your password",
              'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #6
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('Confirmation link has been sent on your email!', 'info')
        return redirect(url_for('users.login'))
    return render_template('reset-request.html',
                           form=form,
                           title='Request Reset Password')
Beispiel #7
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('Um e-mail foi enviado com instruções para redefinir sua senha',
              'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #8
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('На Ваш электронный адрес отправлено письмо для сброса пароля.',
              'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #9
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 mail to this user
        send_reset_mail(user)
        flash('Email reset link has been sent to your register mail', 'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset password',
                           form=form)
Beispiel #10
0
def request_reset_password():
    if current_user.is_authenticated:
        return redirect(url_for('main.home'))

    form = RequestResetForm()
    if form.validate_on_submit():
        user = User.find_by_email(email=form.email.data)
        send_reset_email(user)
        flash('An email with password reset instructions has been sent to you',
              'info')
        return redirect(url_for('users.login'))
    return render_template('request_reset_password.html',
                           title='Request Reset Password',
                           form=form)
Beispiel #11
0
def reset_request():
    players_pattern = get_player_pattern()
    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('users.login'))
    if (request.method == 'POST'):
        return nav_search()
    return render_template('reset_request.html', title='Reset Password', form=form,
                           players_pattern=players_pattern)
Beispiel #12
0
def reset_request():
    # --------------------this is what happens if already loged in --------
    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()
        #now send the user a email
        send_reset_email(user)
        return redirect(url_for("users.login"))

    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #13
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(
            'If an account with this email address exists, a password reset message will be sent shortly.',
            'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #14
0
def reset_request():
    if current_user.is_authenticated:
        return redirect(url_for("main.home_page"))
    form = RequestResetForm()
    # Handling if the form was submitted and validated
    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. Please follow the instructions given in the mail.",
            "info",
        )
        return redirect(url_for("users.login"))
    return render_template("reset_request.html", title="Reset Password", form=form)
Beispiel #15
0
def reset_request():
    # this is to ensure that the user is logged out.
    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('A reset password email has been sent.', 'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #16
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()
        #TODO Handle Exception Case
        send_reset_email(user)
        flash(f'An email with the reset link has been sent to your account.',
              'success')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #17
0
def reset_request():
    # make sure user is logged out first
    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 was sent with instructions to reset your password.",
              "info")
        return redirect(url_for("users.login"))
    return render_template("reset_request.html",
                           title="Reset Password",
                           form=form)
Beispiel #18
0
def reset_request():
    if current_user.is_authenticated:
        return redirect(url_for('main.home_page'))
    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 your account with proper instructios. ',
            'succes')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='request reset password ',
                           form=form)
Beispiel #19
0
def reset_password():
    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(
            'A password reset link has been sent to your email address. \
                It will expire in 3 minutes.', 'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset password',
                           form=form)
Beispiel #20
0
def request_reset():
    if current_user.is_authenticated:
        return redirect(url_for('main.home'))
    form = RequestResetForm()
    if request.method == 'POST':
        if form.validate_on_submit():
            email = form.email.data
            if User.query.filter_by(email=email).first():
                send_request_mail(User.query.filter_by(email=email).first())
                flash(
                    "Check an email and follow the instruction to reset a password",
                    'success')
                return redirect(url_for("users.login"))
    return render_template('request.html', form=form)
Beispiel #21
0
def reset_request():
    # If user is logged in then redirect to home page
    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 to your email with instructions for resetting password",
            "info")
        return redirect(url_for('users.login'))
    return render_template(
        'reset_request.html', form=form,
        title='Reset Request')  # posts variable is passed having value post
Beispiel #22
0
def reset_request():
    #To make sure that the user is logged out.
    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 containing instructions on how to reset your password has been sent.",
            'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
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()
        ##        flash("Google doesn't allow me to send email through their server for now, sorry.",'danger')
        send_reset_email(user)
        flash(
            'An email with instructions to reset your password has been sent to your email address!',
            'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Forget Password',
                           form=form)
Beispiel #24
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_email(user)

        flash(
            "An email has been sent to reset the password\n The email token will expire in 30 minutes",
            "info")
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #25
0
def reset_request():
    if current_user.is_authenticated:
        flash('Please Logout first to reset your password.', 'danger')
        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(
            'Email has been sent plese go to your mail for further instruction',
            'success')
        return redirect(url_for('users.login'))
    return render_template('request_reset.html',
                           form=form,
                           title='Request Password Reset')
Beispiel #26
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(
            'Un email se ha enviado con instrucciones para cambiar la contraseña',
            'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           form=form,
                           title='Resetear Contraseña')
Beispiel #27
0
def reset_request():
    '''Sends an email to the user who requested a password reset'''
    # Make sure user is logged out before resetting password
    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('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #28
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('E-mail enviado. Confira sua caixa de entrada', 'info')
        return redirect(url_for('users.login'))

    return render_template(
        'reset_request.html',
        title='Recuperar senha',
        form=form
    )
Beispiel #29
0
def reset_request():
    """Request password reset"""
    # The user must be logged out to get to the form
    if current_user.is_authenticated:
        return redirect(url_for('main.home'))
    form = RequestResetForm()
    # since forms will return to forms they're sent from we add submet-validation here
    if form.validate_on_submit():
        # get the user
        user = User.query.filter_by(email=form.email.data).first()
        # send email to user
        send_reset_email(user)
        flash('An email has been sent with reset instructions.', 'info')
        return redirect(url_for('users.login'))
    return render_template('reset_request.html',
                           title='Reset Password',
                           form=form)
Beispiel #30
0
def reset_request():
    # if we login then redirect to home
    if current_user.is_authenticated:
        return redirect(url_for('main.home'))
    form = RequestResetForm()
    # if we submit the form
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        send_rest_email(user)
        flash(
            "An Email has been sent with instruction to Reset password! check ypur spam if the message don't show up is the indox!",
            'info')
        return redirect(url_for('users.login'))

    return render_template('reset_request.html',
                           title='Request Reset Password',
                           form=form)
Beispiel #31
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()
        url = url_for('users.reset_token',
                      token=user.get_reset_token(),
                      _external=True)
        send_reset_email.delay(user.email, url)
        flash(
            "An email has been sent with instructions to reset your password.",
            "info")
        return redirect(url_for("users.login"))
    return render_template("reset_request.html",
                           title="Reset Password",
                           form=form)