function RegisterForm::submitForm
Same name in other branches
- 9 core/modules/user/src/RegisterForm.php \Drupal\user\RegisterForm::submitForm()
- 8.9.x core/modules/user/src/RegisterForm.php \Drupal\user\RegisterForm::submitForm()
- 11.x core/modules/user/src/RegisterForm.php \Drupal\user\RegisterForm::submitForm()
Overrides AccountForm::submitForm
File
-
core/
modules/ user/ src/ RegisterForm.php, line 70
Class
- RegisterForm
- Form handler for the user register forms.
Namespace
Drupal\userCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$admin = $form_state->getValue('administer_users');
if (!\Drupal::config('user.settings')->get('verify_mail') || $admin) {
$pass = $form_state->getValue('pass');
}
else {
$pass = \Drupal::service('password_generator')->generate();
}
// Remove unneeded values.
$form_state->cleanValues();
$form_state->setValue('pass', $pass);
$form_state->setValue('init', $form_state->getValue('mail'));
parent::submitForm($form, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.