Forgot Password Form

This document is for a version of Craft CMS that is no longer supported. Please refer to the latest version →

You can create a Forgot Password form using the following code:

<form method="post" accept-charset="UTF-8">
  {{ getCsrfInput() }}
  <input type="hidden" name="action" value="users/sendPasswordResetEmail">
  <input type="hidden" name="redirect" value="">

  <h3><label for="loginName">Username or email</label></h3>
  <input id="loginName" type="text" name="loginName"
      value="{% if loginName is defined %}{{ loginName }}{% else %}{{ craft.session.rememberedUsername }}{% endif %}">

  {% if errors is defined %}
    <ul class="errors">
      {% for error in errors %}
        <li>{{ error }}</li>
      {% endfor %}
  {% endif %}

  <input type="submit" value="Submit">

Craft doesn’t ever automatically create links to your Forgot Password page – only your own templates will link to it – so you don’t need to set any config settings with the path to this page, unlike other pages in the password-reset flow (e.g. setPasswordPath and setPasswordSuccessPath).