Example #1
0
def send_change_password_email(
        request, profile, email=None):
    mailer = get_mailer(request)
    localizer = request.localizer
    data = dict(
        name=profile.name, assembl="Assembl",
        confirm_url=maybe_contextual_route(
            request, 'do_password_change',
            ticket=password_token(profile)))
    message = Message(
        subject=localizer.translate(
            _("Request for password change"), mapping=data),
        sender=config.get('assembl.admin_email'),
        recipients=["%s <%s>" % (
            profile.name, email or profile.get_preferred_email())],
        body=localizer.translate(_(u"""Hello, ${name}!
We have received a request to change the password on your ${assembl} account.
To confirm your password change please click on the link below.
<${confirm_url}>

If you did not ask to reset your password please disregard this email.

Best regards,
The ${assembl} Team
"""), mapping=data),
        html=localizer.translate(_(u"""<p>Hello, ${name}!</p>
<p>We have received a request to change the password on your ${assembl} account.
Please <a href="${confirm_url}">click here to confirm your password change</a>.</p>
<p>If you did not ask to reset your password please disregard this email.</p>
<p>Best regards,<br />The ${assembl} Team</p>
"""), mapping=data))
    # if deferred:
    #    mailer.send_to_queue(message)
    # else:
    mailer.send(message)
Example #2
0
def send_change_password_email(
        request, profile, email=None):
    mailer = get_mailer(request)
    localizer = request.localizer
    data = dict(
        name=profile.name, assembl="Assembl",
        confirm_url=maybe_contextual_route(
            request, 'do_password_change',
            ticket=password_token(profile)))
    message = Message(
        subject=localizer.translate(
            _("Request for password change"), mapping=data),
        sender=config.get('assembl.admin_email'),
        recipients=["%s <%s>" % (
            profile.name, email or profile.get_preferred_email())],
        body=localizer.translate(_(u"""Hello, ${name}!
You asked to change your password on <${assembl}>. (We hope it was you!)\n
You can do this by clicking on the link below.
<${confirm_url}>
"""), mapping=data),
        html=localizer.translate(_(u"""<p>Hello, ${name}!</p>
<p>You asked to <a href="${confirm_url}">change your password</a> on ${assembl} (We hope it was you!)</p>
"""), mapping=data))
    # if deferred:
    #    mailer.send_to_queue(message)
    # else:
    mailer.send(message)
Example #3
0
def send_change_password_email(
        request, profile, email=None, subject=None,
        text_body=None, html_body=None, discussion=None):
    mailer = get_mailer(request)
    localizer = request.localizer
    data = dict(
        assembl="Assembl", name=profile.name,
        confirm_url=maybe_contextual_route(
            request, 'do_password_change',
            ticket=password_token(profile)))
    if discussion:
        data.update(dict(
            discussion_topic=discussion.topic,
            discussion_url=discussion.get_url()))
    subject = subject or localizer.translate(
        _("Request for password change"), mapping=data)
    if text_body is None or html_body is not None:
        # if text_body and no html_body, html_body remains None.
        html_body = html_body or _(u"""<p>Hello, ${name}!</p>
<p>We have received a request to change the password on your ${assembl} account.
Please <a href="${confirm_url}">click here to confirm your password change</a>.</p>
<p>If you did not ask to reset your password please disregard this email.</p>
<p>Best regards,<br />The ${assembl} Team</p>
""")
        html_body = localizer.translate(html_body, mapping=data)
    text_body = text_body or _(u"""Hello, ${name}!
We have received a request to change the password on your ${assembl} account.
To confirm your password change please click on the link below.
<${confirm_url}>

If you did not ask to reset your password please disregard this email.

Best regards,
The ${assembl} Team
""")
    text_body = localizer.translate(text_body, mapping=data)
    message = Message(
        subject=subject,
        sender=config.get('assembl.admin_email'),
        recipients=["%s <%s>" % (
            profile.name, email or profile.get_preferred_email())],
        body=text_body, html=html_body)
    # if deferred:
    #    mailer.send_to_queue(message)
    # else:
    mailer.send(message)
Example #4
0
def send_change_password_email(request, profile, email=None):
    mailer = get_mailer(request)
    localizer = request.localizer
    data = dict(name=profile.name,
                assembl="Assembl",
                confirm_url=maybe_contextual_route(
                    request,
                    'do_password_change',
                    ticket=password_token(profile)))
    message = Message(
        subject=localizer.translate(_("Request for password change"),
                                    mapping=data),
        sender=config.get('assembl.admin_email'),
        recipients=[
            "%s <%s>" % (profile.name, email or profile.get_preferred_email())
        ],
        body=localizer.translate(_(u"""Hello, ${name}!
We have received a request to change the password on your ${assembl} account.
To confirm your password change please click on the link below.
<${confirm_url}>

If you did not ask to reset your password please disregard this email.

Best regards,
The ${assembl} Team
"""),
                                 mapping=data),
        html=localizer.translate(_(u"""<p>Hello, ${name}!</p>
<p>We have received a request to change the password on your ${assembl} account.
Please <a href="${confirm_url}">click here to confirm your password change</a>.</p>
<p>If you did not ask to reset your password please disregard this email.</p>
<p>Best regards,<br />The ${assembl} Team</p>
"""),
                                 mapping=data))
    # if deferred:
    #    mailer.send_to_queue(message)
    # else:
    mailer.send(message)