UserPasswordForm::submitForm

public UserPasswordForm::submitForm(array &$form, FormStateInterface $form_state)

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

core/modules/user/src/Form/UserPasswordForm.php, line 135

Class

UserPasswordForm
Provides a user password reset form.

Namespace

Drupal\user\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $langcode = $this->languageManager->getCurrentLanguage()->getId();

  $account = $form_state->getValue('account');
  // Mail one time login URL and instructions using current language.
  $mail = _user_mail_notify('password_reset', $account, $langcode);
  if (!empty($mail)) {
    $this->logger('user')->notice('Password reset instructions mailed to %name at %email.', array('%name' => $account->getUsername(), '%email' => $account->getEmail()));
    drupal_set_message($this->t('Further instructions have been sent to your email address.'));
  }

  $form_state->setRedirect('user.page');
}
doc_Drupal
2016-10-29 09:52:50
Comments
Leave a Comment

Please login to continue.