コード例 #1
0
ファイル: web.py プロジェクト: Pmtague/ihatemoney
def remind_password():
    form = PasswordReminder()
    if request.method == "POST":
        if form.validate():
            # get the project
            project = Project.query.get(form.id.data)
            # send a link to reset the password
            remind_message = Message(
                "password recovery",
                body=render_localized_template("password_reminder",
                                               project=project),
                recipients=[project.contact_email],
            )
            success = send_email(remind_message)
            if success:
                return redirect(url_for(".password_reminder_sent"))
            else:
                flash(
                    _("Sorry, there was an error while sending you an email "
                      "with password reset instructions. "
                      "Please check the email configuration of the server "
                      "or contact the administrator."),
                    category="danger",
                )
                # Fall-through: we stay on the same page and display the form again
    return render_template("password_reminder.html", form=form)
コード例 #2
0
def remind_password():
    form = PasswordReminder()
    if request.method == "POST":
        if form.validate():
            # get the project
            project = Project.query.get(form.id.data)

            # send the password reminder
            password_reminder = "password_reminder.%s" % get_locale().language
            current_app.mail.send(Message(
                "password recovery",
                body=render_template(password_reminder, project=project),
                recipients=[project.contact_email]))
            flash(_("a mail has been sent to you with the password"))

    return render_template("password_reminder.html", form=form)
コード例 #3
0
ファイル: web.py プロジェクト: Glandos/ihatemoney
def remind_password():
    form = PasswordReminder()
    if request.method == "POST":
        if form.validate():
            # get the project
            project = Project.query.get(form.id.data)

            # send a link to reset the password
            password_reminder = "password_reminder.%s.j2" % get_locale().language
            current_app.mail.send(Message(
                "password recovery",
                body=render_template(password_reminder, project=project),
                recipients=[project.contact_email]))
            flash(_("A link to reset your password has been sent to your email."))

    return render_template("password_reminder.html", form=form)
コード例 #4
0
def remind_password():
    form = PasswordReminder()
    if request.method == "POST":
        if form.validate():
            # get the project
            project = Project.query.get(form.id.data)
            # send a link to reset the password
            password_reminder = f"password_reminder.{get_locale().language}.j2"
            current_app.mail.send(
                Message(
                    "password recovery",
                    body=render_template(password_reminder, project=project),
                    recipients=[project.contact_email],
                ))
            return redirect(url_for(".password_reminder_sent"))

    return render_template("password_reminder.html", form=form)