Reminding Passwords

This is a user-contributed Extra. If you find issues or would like more info or help, please contact the author.
The following information was taken from an automated translation of the original Russian text - it may therefore not be 100% correct and meaningful.

The Reminder Controller allows web users to recover forgotten passwords. Extends the Form controller.

Password recovery is performed according to the following scheme:

  • the user enters his ID in the form (it can be a username or an email);
  • the user receives an email containing a link for recovery;
  • when clicking on the link, the user can enter a new password or the password will be generated automatically;
  • the user is sent an email with a new password and a message is displayed (you can also display a new password in the message).

The to parameter is overwritten by the user's email value. The resetTo parameter must be specified.

Parameters

Property Description
model

Class for working with users.

Possible values are the class name.

The default value is \ modUsers

modelPath

The path to the class file for working with users.

Possible values are the relative path to the file.

The default value is assets / lib / MODxAPI / modUsers.php

hashField

The name of the field for storing the user's hash.

The default value is hash.

userField

The name of the field to store the user ID (username or email).

The default value is email.

uidField

The name of the field that is used to identify the user when clicking on the link.

The default value is id.

exitTo

Redirects an authorized user to the specified page.

The possible values are the id of the landing page.

The default value is empty.

resetTo

The page to which the link for password recovery will point. Required.

The possible values are the id of the landing page.

The default value is the id of the document in which the controller is invoked.

redirectTo

Redirects to the specified page after successful password recovery.

The possible values are the id of the landing page.

The default value is empty.

skipTpl

A message template for an authorized user.

Possible values are the name of the template specified by the rules for setting templates in DocLister.

The default value is a record from the Reminder lexicon with the [+reminder.default_skipTpl+] key.

formTpl

Template form for entering the user ID.

Possible values are the name of the template specified by the rules for setting templates in DocLister.

The default value is empty.

resetTpl

Template form for entering a new password. If the parameter is not set, the password will be generated automatically.

The fields for entering passwords must be called password and repeatPassword. The form should also contain hidden fields with names from the parameters uidField and hashField. The value for the hashField field is specified via the placeholder [+user.hash +].

Possible values are the name of the template specified by the rules for setting templates in DocLister.

The default value is empty.

successTpl

Template of the message about the successful sending of the letter with the link for password recovery. In the template, you can output placeholders with user data (username, email, etc.).

Possible values are the name of the template specified by the rules for setting templates in DocLister.

The default value is a record from the Reminder lexicon with the [+reminder.default_successTpl+] key.

resetSuccessTpl

Template of the message about successful password recovery. In the template, you can output placeholders with user data (username, email, etc.), as well as a new password (newpassword).

Possible values are the name of the template specified by the rules for setting templates in DocLister.

The default value is a record from the Reminder lexicon with the [+reminder.default_resetSuccessTpl+] key.

reportTpl

Template of the letter with the link for password recovery. In the template, you can output placeholders with user data (username, email, etc.), as well as a new password (newpassword). The link for password recovery in the letter is set via the placeholder [+reset.url +]

Possible values are the name of the template specified by the rules for setting templates in DocLister.

The default value is a record from the Reminder lexicon with the [+reminder.default_reportTpl+] key.

resetReportTpl

Template of the letter about successful password recovery. In the template, you can output placeholders with user data (username, email, etc.), as well as a new password (newpassword). If not specified, then the user will not be sent a letter.

Possible values are the name of the template specified by the rules for setting templates in DocLister.

The default value is empty.

rules

Validation rules for the user authentication form.

Possible values - see the section "Data Validation".

The default value is empty.

resetRules

Validation rules for the form of setting a new password. If validation rules are set for the password and repeatPassword fields, then if there is an equals rule for the repeatPassword field, it will be automatically corrected to check the equality of the password and repeatPassword fields:

"repeatPassword":{
    "required":"Retype password",
    "equals":{
        "params":"This key in the description of the rule can not be set, it will be generated by the controller automatically",
        "message":"Passwords do not match"
    }
}

Possible values - see the section "Data Validation".

The default value is empty.

passwordLength

The length of the password (if created automatically).

Possible values are more than 6 characters.

The default value is 6.

Suggest an edit to this page.