user_pass
function user_pass
user_pass()
Form builder; Request a password reset.
See also
Related topics
File
- modules/user/user.pages.inc, line 30
- User page callback file for the user module.
Code
function user_pass() { global $user; $form['name'] = array( '#type' => 'textfield', '#title' => t('Username or e-mail address'), '#size' => 60, '#maxlength' => max(USERNAME_MAX_LENGTH, EMAIL_MAX_LENGTH), '#required' => TRUE, '#default_value' => isset($_GET['name']) ? $_GET['name'] : '', ); // Allow logged in users to request this also. if ($user->uid > 0) { $form['name']['#type'] = 'value'; $form['name']['#value'] = $user->mail; $form['mail'] = array( '#prefix' => '<p>', // As of https://www.drupal.org/node/889772 the user no longer must log // out (if they are still logged in when using the password reset link, // they will be logged out automatically then), but this text is kept as // is to avoid breaking translations as well as to encourage the user to // log out manually at a time of their own choosing (when it will not // interrupt anything else they may have been in the middle of doing). '#markup' => t('Password reset instructions will be mailed to %email. You must log out to use the password reset link in the e-mail.', array('%email' => $user->mail)), '#suffix' => '</p>', ); } $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('E-mail new password')); return $form; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!user!user.pages.inc/function/user_pass/7.x