You are here

function username_enumeration_prevention_pass_submit in Username Enumeration Prevention 6

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

Overrides the Drupal Core user_pass_submit() function found in user.pages.inc

1 string reference to 'username_enumeration_prevention_pass_submit'
username_enumeration_prevention_form_alter in ./username_enumeration_prevention.module
Implements hook_form_alter(). Checks for the user password reset form and changes the validate and submit functions. Uses the overrided functions defined in this module instead of Drupal cores.

File

./username_enumeration_prevention.module, line 87
Main file for the Username Enumeration Prevention. Adds the required functionality for removing the reset password error message. Also, if views is installed restricts the callback function to work only for users with the access user profiles permission.

Code

function username_enumeration_prevention_pass_submit($form, &$form_state) {
  global $language;
  if (isset($form_state['values']['account'])) {
    $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,
    ));
    drupal_set_message(t('Further instructions have been sent to your e-mail address.'));
  }
  $form_state['redirect'] = 'user';
  return;
}