function UserPasswordForm::submitForm
Same name in other branches
- 9 core/modules/user/src/Form/UserPasswordForm.php \Drupal\user\Form\UserPasswordForm::submitForm()
- 10 core/modules/user/src/Form/UserPasswordForm.php \Drupal\user\Form\UserPasswordForm::submitForm()
- 11.x core/modules/user/src/Form/UserPasswordForm.php \Drupal\user\Form\UserPasswordForm::submitForm()
Overrides FormInterface::submitForm
File
-
core/
modules/ user/ src/ Form/ UserPasswordForm.php, line 178
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.', [
'%name' => $account->getAccountName(),
'%email' => $account->getEmail(),
]);
$this->messenger()
->addStatus($this->t('Further instructions have been sent to your email address.'));
}
$form_state->setRedirect('user.page');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.