<dtml-comment>
We use this as a hook into the existing password mailing
machinery. Otherwise, the resetRequest would go in a 
previous step.
</dtml-comment>

<dtml-try>
  <dtml-call "REQUEST.set('mem_id', member.getId())">
<dtml-except Unauthorized>
  <dtml-comment>
    CMFMember might be installed, check to see if member_id is provided
    for us in our namespace.
  </dtml-comment>
  <dtml-try>
    <dtml-call "REQUEST.set('mem_id', member_id)">
  <dtml-except NameError>
    <dtml-raise type="Password Reset Failure">Cannot retrieve member id.</dtml-raise>
  </dtml-try>
</dtml-try>

<dtml-try>
  <dtml-call "REQUEST.set('mem_email', member.getProperty('email'))">
<dtml-except Unauthorized>
  <dtml-comment>
    CMFMember might be installed, check to see if member_email is provided
    for us in our namespace.
  </dtml-comment>
  <dtml-try>
    <dtml-call "REQUEST.set('mem_email', member_email)">
  <dtml-except NameError>
    <dtml-raise type="Password Reset Failure">Cannot retrieve member email address.</dtml-raise>
  </dtml-try>
</dtml-try>

<dtml-let reset="portal_password_reset.requestReset(REQUEST.get('mem_id'))">

<dtml-with portal_properties>
From: "&dtml-email_from_name;" <&dtml-email_from_address;>
To: <dtml-var "REQUEST.get('mem_email')">
Errors-to: <&dtml-email_from_address;>
Subject: <dtml-translate msgid="mailtemplate_subject_resetpasswordrequest" domain="passwordresettool">Password reset request</dtml-translate>

Content-Type: text/plain; charset="utf-8"

<dtml-translate msgid="mailtemplate_text_linkreset" domain="passwordresettool">Someone requested that the password to your account at &dtml-title; </dtml-translate> &dtml-title; <dtml-translate msgid="mailtemplate_text_linkreset2" domain="passwordresettool">be reset.

If this was not you, you may safely do nothing.

If you wish to proceed and reset your password, please visit this address:</dtml-translate>

<dtml-var "pwreset_constructURL(reset['randomstring'])">

<dtml-translate msgid="mailtemplate_text_expirationdate_linkreset" domain="passwordresettool">This password reset request will expire in</dtml-translate> <dtml-var "portal_password_reset.getExpirationTimeout()"> <dtml-translate msgid="mailtemplate_hours" domain="passwordresettool">hours on</dtml-translate> <dtml-var "reset['expires'].aCommonZ()">

<dtml-translate msgid="mailtemplate_trackingaddress" domain="passwordresettool">Tracking information:

Request made from IP address</dtml-translate> <dtml-if HTTP_X_FORWARDED_FOR><dtml-var "REQUEST.HTTP_X_FORWARDED_FOR"><dtml-else><dtml-var "REQUEST.REMOTE_ADDR"></dtml-if> <dtml-translate msgid="mailtemplate_trackingon" domain="passwordresettool">at</dtml-translate> <dtml-var ZopeTime>

</dtml-with>

</dtml-let>