This is the documentation for LemonStand V1, which has been discontinued. You can learn more and upgrade your store here.

LemonStand Version 1 Has Been Discontinued

This documentation is for LemonStand Version 1. LemonStand is now offered as a cloud-based eCommerce platform.
You can try the new LemonStand and learn about upgrading here.

Creating a Customer Account Password Restore Page

LemonStand supports two ways of restoring a password: requesting the new password by email, when new new password is generated by LemonStand and sent to a customer, and requesting the Password Reset link, when the temporary link is sent to the customer by email and can be used to enter a new password manually.

Request new password page

This section describes how to build a page that sends a new password by email. The Password restore page allows customers to reset their passwords. The password restore page contains a simple form with only one field – email address. After entering their email address and submitting the form, the customer receives an email message with their new password.

To create the password restore page, create a new page and assign it a name and URL. The values of the name and URL can be anything. Click the Action tab and select the shop:password_restore action in the action drop-down menu.

The following code contains an example of a simple password restore form.

<h2>Password Restore</h2>
<?= open_form() ?>
	<?= flash_message() ?>
	<label for="email">Email</label>
	<input id="email" type="text" name="email" value="<?= h(post('email')) ?>" class="text"/><br/>
	
	<input type="submit" name="password_restore" value="Submit"/>
	<input type="hidden" name="redirect" value="/password_restore_success"/>
</form> 
<h2>Password Restore</h2>
{{ open_form() }}
  {{ flash_message() }}
	<label for="email">Email</label>
	<input id="email" type="text" name="email" value="{{ post('email') }}" class="text"/><br/>
	
	<input type="submit" name="password_restore" value="Submit"/>
	<input type="hidden" name="redirect" value="/password_restore_success"/>
</form> 

The code outputs the HTML FORM element using the open_form function. The flash_message function outputs the form processing errors. Please note you should not change the input field and submit button element names and Ids. The optional hidden field with the name redirect can be used for redirecting a visitor's browser to the confirmation page after submitting the password restore form.

Customizing the password restore email message

You can customize the text of the default LemonStand password restore email message. Go to the Settings/Email Templates page and click the shop:password_reset message template.

This section describes how to build a page which sends a temporary password restore link by email.

The password request page is based on the shop:password_restore_request action. Depending on the context the page either displays a form for entering the customer email, or a form for entering the new password and its confirmation. To create the password restore page, create a new page and assign it a name and URL. The values of the name and URL can be anything. Click the Action tab and select the shop:password_restore_request action in the action drop-down menu.

The following code contains an example of a simple password restore form.

<?= flash_message() ?>

<? if ($action_mode == 'restore_request' || isset($invalid_hash)): ?>
  <? if (!isset($invalid_hash)): ?>
    <?= open_form() ?>
  <? else: ?>
    <?= open_form(array('action' => root_url($this->page->url, true))) ?>
  <? endif ?>
      Please enter your email below, we will send you an email with a link to enter a new password for your account.<br>
      Email: <input type="text" value="" name="customer_email"><br>
      <input type="hidden" name="success_message" value="Password restore email was sent.">
      <input type="submit" value="Request Password Reset" name="password_restore_submit">
    </form>
<? else: ?>
  <?= open_form() ?>
    Enter a new password for your account below and confirm the change.<br>
    Password: <input type="password" name="new_password" value=""><br>
    Confirm Password: <input type="password" name="confirm_password" value=""><br>
    <input type="hidden" name="redirect" value="<?= root_url('login', true) ?>">
    <input type="hidden" name="success_message" value="Your password was successfully changed, you may now login with your new password.">
    <input type="submit" value="Set new password" name="password_restore_submit">
  </form>
<? endif ?>
{{ flash_message() }}

{% if action_mode == 'restore_request' || invalid_hash %}
  {% if not invalid_hash %}
    {{ open_form() }}?>
  {% else %}
    {% set action = root_url(this.page.url, true) %}
    {{ open_form({'action': action}) }}?>
  {% endif %}
      Please enter your email below, we will send you an email with a link to enter a new password for your account.<br>
      Email: <input type="text" value="" name="customer_email"><br>
      <input type="hidden" name="success_message" value="Password restore email was sent.">
      <input type="submit" value="Request Password Reset" name="password_restore_submit">
    </form>
{% else %}
  {{ open_form() }}
    Enter a new password for your account below and confirm the change.<br>
    Password: <input type="password" name="new_password" value=""><br>
    Confirm Password: <input type="password" name="confirm_password" value=""><br>
    <input type="hidden" name="redirect" value="{{ root_url('login', true) }}">
    <input type="hidden" name="success_message" value="Your password was successfully changed, you may now login with your new password.">
    <input type="submit" value="Set new password" name="password_restore_submit">
  </form>
{% endif %}

To customize the email message that is sent when the customer password reset is requested please edit the shop:password_restore email template.

Next: Creating a Customer Account Change Password Page
Previous: Creating a Customer Registration Page
Return to Customer Accounts and Registration