def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            _('Check your email for the instructions to reset your password'))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=_('Reset Password'), form=form)
Exemple #2
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash('Check your email for the instructions to reset your password')
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='Reset Password',
                           form=form)
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(_('Kolla din mail för instruktioner'))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=_('Återställ lösenord'),
                           form=form)
Exemple #4
0
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(_('请查收邮件,按照说明重置密码'))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=_('重置密码'),
                           form=form)
Exemple #5
0
def reset_password_request():
    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(
            'Veuillez vérifier votre boite mail pour savoir comment réinitialiser votre mot de passe.'
        )
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='Réinitialiser votre mot de passe',
                           form=form)
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash("An email with instructions was sent to your address.")
        return redirect(url_for("auth.login"))
    return render_template(
        "auth/reset_password_request.html", title="Reset Password", form=form
    )
Exemple #7
0
def reset_password_request():
    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.lower()).first()
        if user:
            send_password_reset_email(user)
        flash(_('Bitte kontrolliere deine Emails für weitere anweisungen'))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=_('Passwort zurücksetzen'),
                           form=form)
Exemple #8
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            'Jums ir nosūtīts e-pasts ar norādījumiem paroles atiestatīšanai.')
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='Paroles atiestatīšana',
                           form=form)
Exemple #9
0
def reset_password_request():
    if current_user.is_authenticated:
        return redirect(url_for('main.index'))
    form = ResetPasswordRequestForm()
    if form.validate_on_submit():
        user = User.search([('email', '=', str(form.email.data))])
        if user:
            User.reset_password(user)
        flash(
            _('Check your email for the instructions to reset your password'))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=_('Reset Password'),
                           form=form)
Exemple #10
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            _('Проверте свой email для получения инструкции по смене пароля'))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=_('Reset Password'),
                           form=form)
Exemple #11
0
def reset_password_request():
    if current_user.is_authenticated:
        return redirect(url_for('blog.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('重置链接已发,请留意您的邮箱.')
            return redirect(url_for('auth.login'))
        flash('邮箱未注册.')
        return redirect(url_for('auth.reset_password_request'))
    return render_template('auth/reset_password_request.html', form=form)
Exemple #12
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash("Sprawdź proszę swoją skrzynkę pocztową. Dalsze instrukcje \
              czekają tam na Ciebie.")
        return redirect(url_for("auth.login"))
    return render_template("auth/reset_password_request.html",
                           title="Reset Password",
                           form=form)
Exemple #13
0
def reset_password_request():
    if current_user.is_authenticated:
        return redirect(
            url_for('index'))  #Loggedin users shouldnt be able to access
    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('Reset password instructions have been sent to your email.')
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='Reset Password',
                           form=form)
Exemple #14
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            _l('Проверьте вашу почту на наличие инструкции для сброса пароля'))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='Сброс пароля',
                           form=form)
def reset_password_request():
    # 登陆状态不允许
    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).first()
        if user:
            send_password_reset_email(user)
        flash('邮件已经发送到你的邮箱,请检查你的邮箱')
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='重置密码',
                           form=form)
Exemple #16
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
            flash('Password-resetting mail has been sent. Check your inbox as soon as possible.')
        else:
            flash('Invalid email address. Try entering the email address of your logging account.')
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html', title='Reset your password', form=form,
                           Permission=Permission)
Exemple #17
0
def reset_password_request():
    if current_user.is_authenticated:
        return redirect(url_for("main.index"))
    form = ResetPasswordRequestForm()
    if form.validate_on_submit():
        user = select_user_by_email(form.email.data)
        if user:
            send_password_reset_email(user)
        flash(
            _("Check your email for the instructions to reset your password"))
        return redirect(url_for("auth.login"))
    return render_template("auth/reset_password_request.html",
                           title=_("Reset Password"),
                           form=form)
Exemple #18
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            _('Проверьте свою почту для получения возможности восстановить пароль.'
              ))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=_('Reset Password'),
                           form=form)
Exemple #19
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            _('Por favor, verifique seu e-mail para concluir a sua renomeação de senha'
              ))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=(_('Renomear Senha')),
                           form=form)
Exemple #20
0
def reset_password_request():
    '''View for requesting a password reset.'''
    if current_user.is_authenticated:
        logout_user()

    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 link to reset your password.',
              category='auth-success')
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='Reset Password', form=form)
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            _('Verifique seu e-mail para obter instruções para redefinir sua senha'
              ))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=_('Redefina sua senha'),
                           form=form)
Exemple #22
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            'Проверьте свою электронную почту для получения инструкций по сбросу пароля'
        )
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='Сброс пароля',
                           form=form)
Exemple #23
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            _("Jette un coup d'oeil à tes emails et suis les instructions de réinitialisation de ton mot de passe."
              ))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=_('Réinitialisation du mot de passe'),
                           form=form)
Exemple #24
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            _('We will send you a reset password if we have an account linked to your email!'
              ))
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title=_('Reset Password'),
                           form=form)
Exemple #25
0
def reset_password_request():
    nav_form = LoginForm(request.form)
    if current_user.is_authenticated:
        flash(_('You are already logged in.'), 'info')
        return redirect(url_for('public.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(_('Check your email for the instructions to reset your password'))
        return redirect(url_for('auth.login'))
    return render_template('reset_password_request.html',
                           title='Reset Password',
                           nav_form=nav_form, form=form)
Exemple #26
0
def reset_password_request():
    """View function for PasswordResteForm"""
    if current_user.is_authenticated:
        return redirect(url_for('index'))
    form = ResetPasswordRequestForm()
    if form.validate_on_submit():
        userm = User.query.filter_by(email=form.email.data).first()
        if userm:
            send_password_reset_email(userm)
        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)
Exemple #27
0
def reset_password_request_submit():
    """Request Password Reset Submit endpoint."""
    form = ResetPasswordRequestForm()
    if form.validate_on_submit():
        user = User.get(email=form.email.data)
        if user:
            send_password_reset(user)
            flash(
                'Check your email for the instructions to reset your password')
            return redirect(url_for('auth.login'))
        else:
            flash(
                'There is no user associated with that email. Please try again.'
            )
    return redirect(url_for('auth.reset_password_request'))
Exemple #28
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(_('Check your email for the link to reset your password.'))
        # The flashed message is displayed even if the email provided by the
        # user is unknown. This is so that clients cannot use this form to
        # figure out if a given user is a member or not.
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='Reset Password', form=form)
Exemple #29
0
def reset_password_request():
    """requests a reset password token email"""
    if current_user.is_authenticated:
        return redirect(url_for("main.index"))
    form = ResetPasswordRequestForm()
    if (form.validate_on_submit()
            and User.query.filter_by(email=form.email.data).first()):
        send_password_reset_email(
            User.query.filter_by(email=form.email.data).first())
        flash(f"Check your email for the instructions to reset your password",
              "warning")
        return redirect(url_for("auth.login_page"))
    return render_template("auth/reset_password_request.html",
                           title="Reset Password",
                           form=form)
Exemple #30
0
def reset_password_request():
    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).first()
        if user is not None:
            send_password_reset_email(user)
        flash(
            _('You will be receiving an email with the instructions to '
              'reset your password.'))
        return redirect(url_for('auth.login'))
    return render_template('reset_password_request.html',
                           title='Reset Password',
                           form=form)
Exemple #31
0
def reset_password_request():
    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).first()
        if user:
            send_password_reset_email(user)
        flash(
            'На Ваш почтовый адрес была отправлена инструкция по сбросу пароля'
        )
        return redirect(url_for('auth.login'))
    return render_template('auth/reset_password_request.html',
                           title='Сброс пароля',
                           form=form)
Exemple #32
0
def reset_password_request():
    if not current_user.is_anonymous:
        return redirect(url_for('main.index'))
    form = ResetPasswordRequestForm()
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        if user:
            token = user.generate_reset_token()
            send_email(user.email, 'Reset Your Password', 'auth/email/reset_password',
                       user=user, token=token, next=request.args.get('next'))
            flash('An email with instructions to reset your password has been sent ot you.')
            return redirect(url_for('auth.login'))
        else:
            return redirect(url_for('main.index'))

    return render_template('auth/reset_password.html', form=form)