User Documentation

User:Forgot_Password template tag

The User:Forgot_Password function allows your users to retrieve their forgotten password to your site by entering in their email address on file.

{exp:user:forgot_password} content {/exp:user:forgot_password}

Parameters

The following parameters are available for use:

error_page=

error_page="user/error_template"

This parameter allows you to bypass the EE message template for displaying errors, and instead show your own regular template with the error messages. Error template must follow guidelines of User Error Page.

form:attribute=

form:class="your_class"

This parameter allows you to control any form attribute for the form in your template. Simply replace attribute with an attribute name such as id, name, class, etc, and specify a value for that attribute. You can specify this parameter multiple times to control as many attributes as necessary. This would normally be done to control your form with Javascript or style it with CSS.

onsubmit=

onsubmit="some_javascript()"

This parameter allows you to execute Javascript functions at form submission.

password_reset_template=

password_reset_template="user_main/reset_password/%id%"

This parameter allows you specify the URI of your Reset Password template so you can customize the password reset experience. Without this parameter, User will send the default reset token to the user which will use ExpressionEngine's built-in reset password form.

The %id% portion of the URI allows you to specify where in the URL the reset token is put when emailed to the user.

password_reset_email_subject=

password_reset_email_subject="Password Reset Request"

This parameter allows you specify the subject of the reset email sent to the user. If you do not specify the subject, the default ExpressionEngine password reset subject will be used.

password_reset_email_template=

password_reset_email_template="user_notifications/reset_password"

This parameter allows you to specify an EE template to be used for the email sent to the user when requesting a password form. This template does not support a full template parsing and only the following tags are available:

  • email - email address of user submitting the form
  • member_id - member_id of user submitting request
  • name - screen name of user submitting the form
  • reset_url - full URL path to the reset password template, using the value provided in password_reset_template parameter
  • screen_name - screen name of user
  • site_name - name of the site
  • site_url - base URL for the site
  • username - user name of user submitting the form

If you do not specify this template, the default ExpressionEngine password reset email template will be used.

return=

return="user/success"

This parameter allows you specify a return URL you'd like the user to be returned to after submitting the form.

secure_action=

secure_action="yes"

This parameter allows you to set the action on the form to have https://. Use for processing forms with SSL.

secure_return=

secure_return="yes"

This parameter allows you to set the return on the form to have https://. Use for processing forms with SSL.

secure_reset_link=

secure_reset_link="yes"

This parameter allows you specify if the link to the password reset template page should be forced to use https://.

Form Fields

The following form fields are available for use:

email

<input type="text" name="email" id="email" />

This field is the field in which the user would specify their email address to retrieve their password, and is a required field.

Examples

The following is a complete example of what a Forgot Password form might look like:

<h2>Forgot Password?</h2>
<p>
    If you've forgotten your password, just enter your email address you registered with and you will receive an email with instructions for resetting your Password.
</p>

{exp:user:forgot_password
    password_reset_template="user_main/reset_password/%id%"
    password_reset_email_subject="Password Reset Request"
    password_reset_email_template="user_notifications/reset_password"
    return="user/success"
}
<p>
    <label for="email">Email Address <span class="required">*</span></label>
    <input type="text" name="email" id="email" />
    <button type="submit">Reset Password</button>
</p>
{/exp:user:forgot_password}

And then a sample Reset Password email template (in this case, located at user_notifications/reset_password):

Hi {name},

To reset your password, please go to the following page:

{reset_url}

If you do not wish to reset your password, ignore this message. It will expire in 24 hours.

{site_name}
{site_url}

Support

Having problems setting up and/or using User? Support is offered from 10am to 4pm EST weekdays. Send us an email at help@eeharbor.com and we will respond as quickly as we can.