Same name and namespace in other branches
  1. 4.7.x modules/user.module \user_pass_submit()
  2. 5.x modules/user/user.module \user_pass_submit()
  3. 6.x modules/user/user.pages.inc \user_pass_submit()

Form submission handler for user_pass().

See also

user_pass_validate()

File

modules/user/user.pages.inc, line 117
User page callback file for the user module.

Code

function user_pass_submit($form, &$form_state) {
  global $language;
  $name = $form_state['values']['name'];
  if (isset($form_state['values']['account'])) {
    $account = $form_state['values']['account'];

    // Mail one time login URL and instructions using current language.
    $mail = _user_mail_notify('password_reset', $account, $language);
    if (!empty($mail)) {
      watchdog('user', 'Password reset instructions mailed to %name at %email.', array(
        '%name' => $account->name,
        '%email' => $account->mail,
      ));
    }
  }
  else {
    watchdog('user', 'Password reset form was submitted with an unknown or inactive account: %name.', array(
      '%name' => $name,
    ));
  }
  $password_reset_text = variable_get('user_password_reset_text', t('If %identifier is a valid account, an email will be sent with instructions to reset your password.'));
  drupal_set_message(format_string($password_reset_text, array(
    '%identifier' => $name,
  )));
  $form_state['redirect'] = 'user';
  return;
}