public function UserPasswordForm::submitForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/user/src/Form/UserPasswordForm.php \Drupal\user\Form\UserPasswordForm::submitForm()
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 140 - Contains \Drupal\user\Form\UserPasswordForm.
Class
- UserPasswordForm
- Provides a user password reset form.
Namespace
Drupal\user\FormCode
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');
}