예제 #1
0
파일: views.py 프로젝트: samhains/plutoc
    def post(self):
        form = self.form()
        if form.validate_on_submit():
            user = User.query.filter_by(email=form.email.data).first()

            if user:
                send_reset_token.delay(user)
                flash(_("Email sent! Please check your inbox."), "info")
                return redirect(url_for("auth.forgot_password"))
            else:
                flash(
                    _("You have entered an username or email address that is "
                      "not linked with your account."), "danger")
        return render_template("auth/forgot_password.html", form=form)
예제 #2
0
파일: views.py 프로젝트: djsilcock/flaskbb
def forgot_password():
    """Sends a reset password token to the user."""
    if not current_user.is_anonymous:
        return redirect(url_for("forum.index"))

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

        if user:
            send_reset_token.delay(user)
            flash(_("Email sent! Please check your inbox."), "info")
            return redirect(url_for("auth.forgot_password"))
        else:
            flash(_("You have entered an username or email address that is "
                    "not linked with your account."), "danger")
    return render_template("auth/forgot_password.html", form=form)
예제 #3
0
파일: views.py 프로젝트: JackieyQi/flaskbb
def forgot_password():
    """Sends a reset password token to the user."""
    if not current_user.is_anonymous:
        return redirect(url_for("forum.index"))

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

        if user:
            send_reset_token.delay(user)
            flash(_("Email sent! Please check your inbox."), "info")
            return redirect(url_for("auth.forgot_password"))
        else:
            flash(_("You have entered an username or email address that is "
                    "not linked with your account."), "danger")
    return render_template("auth/forgot_password.html", form=form)