You are here

function username_enumeration_prevention_pass_submit in Username Enumeration Prevention 7

Same name and namespace in other branches
  1. 8 username_enumeration_prevention.module \username_enumeration_prevention_pass_submit()
  2. 6 username_enumeration_prevention.module \username_enumeration_prevention_pass_submit()

Overrides the user_pass_submit() found in user.pages.inc.

1 string reference to 'username_enumeration_prevention_pass_submit'
username_enumeration_prevention_form_user_pass_alter in ./username_enumeration_prevention.module
Implements hook_form_FORM_ID_alter().

File

./username_enumeration_prevention.module, line 70
Main file for the Username Enumeration Prevention.

Code

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

    // Mail one time login URL and instructions using current language.
    _user_mail_notify('password_reset', $account, $language);
    watchdog('user', 'Password reset instructions mailed to %name at %email.', array(
      '%name' => $account->name,
      '%email' => $account->mail,
    ));
  }

  // Set the same message as when an email has been sent whenever the form is
  // submitted. Moved from validation callback to prevent message to be
  // displayed in case there is another form error for other modules like
  // captcha.
  drupal_set_message(t('Further instructions have been sent to your e-mail address.'));
  $form_state['redirect'] = 'user';
}