shop:password_restore_request CMS action
Defined in |
/modules/shop/classes/shop_actions.php, lines 3234-3250 |
Author |
LemonStand eCommerce Inc. |
The action generates a password restore hash for a customer with the specified email address and sends an
email notification to the customer (using shop:password_restore email template).
Usage example:
<?= 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 ?>
Field |
Type |
Description |
customer_email |
string |
specifies the customer's email address. Required when requesting a password restore. |
password_restore_submit |
string |
optional SUBMIT input element name. |
redirect |
string |
an optional field containing an URL for redirecting the browser after password restore request has been submitted. |
success_message |
string |
an optional message to display after the redirection. |
Variable |
Type |
Description |
action_mode |
string |
set to 'password_update' when the page url contains the password restore hash (customer is expected to enter a new password) and 'restore_request' when it does not (customer will enter their email to request a password restore). |
success |
boolean |
set to true if a password was successfully reset or the password restore email was sent. |
invalid_hash |
boolean |
set to true if the password restore link is invalid (invalid hash), was previously used or is expired (hash was generated more than 24 hours ago). |
Supported form field details
¶
customer_email form field
Specifies the customer's email address. Required when requesting a password restore.
¶
password_restore_submit form field
Optional SUBMIT input element name.
The submit button should have name password_restore_submit if you are implementing a regular POST form.
Alternatively you can create an AJAX form with shop:on_passwordRestoreRequest handler.
¶
redirect form field
An optional field containing an URL for redirecting the browser after password restore request has been submitted.
Use root_url() function if your copy of LemonStand is installed in a subdirectory.
¶
success_message form field
An optional message to display after the redirection.
Use the flash_message() function on the target page to display the message.
Generated PHP variable details
¶
action_mode variable
string $action_mode;
Set to 'password_update' when the page url contains the password restore hash (customer is expected to enter a new password) and 'restore_request' when it does not (customer will enter their email to request a password restore).
¶
success variable
boolean $success;
Set to true if a password was successfully reset or the password restore email was sent.
¶
invalid_hash variable
boolean $invalid_hash;
Set to true if the password restore link is invalid (invalid hash), was previously used or is expired (hash was generated more than 24 hours ago).
Built-in AJAX handlers details
¶
shop:on_passwordRestore AJAX handler
Processes the password restore form.
Use this handler for creating a Submit link or button on the password restore page. Example:
<a href="#" onclick="return $(this).getForm().sendRequest('shop:on_passwordRestoreRequest')">Submit</a>
|