Resolve #85494 "Use email verification 9.3.x"
5 unresolved threads
Rebase off 9.3.x Added test per comment #279.6 Addressed feedback from MR 437 except disputed comments
Merge request reports
Activity
added 76 commits
-
517573f7...c992b724 - 68 commits from branch
project:9.3.x
- af0ea048 - Apply the patch #312
- 98027546 - Replace deprecated method calls in test
- f804ff2a - add test for wrong email address in link (& rebase off 9.3.x)
- 15a63214 - address feedback from MR composer remove drupal/webform
- bf07c59d - remove extra space
- 7831aa45 - Changed text on user account page when email has been changed
- 21785e39 - Updated subject line of notification email when user's email is changed
- 49337955 - Merge branch '85494-use-email-verification-9.3.x' of...
Toggle commit list-
517573f7...c992b724 - 68 commits from branch
added 1 commit
- 2138aaff - Perform email notification for mail change after ::save is completed so...
457 } 458 } 459 460 /** 461 * Send notifications after the account is updated. 462 * This callback is called after ::submitForm and ::save complete, so that the user 463 * entity is guaranteed to be fully updated with any new password hashes. 464 * This ensures that notifications that contain any URLs using user_pass_rehash are 465 * valid and are able to use the hashed password that is generated upon save only. 466 * 467 * @param array $form 468 * An associative array containing the structure of the form. 469 * @param \Drupal\Core\Form\FormStateInterface $form_state 470 * The current state of the form. 471 */ 472 public function notify(array &$form, FormStateInterface $form_state) { 469 * @param \Drupal\Core\Form\FormStateInterface $form_state 470 * The current state of the form. 471 */ 472 public function notify(array &$form, FormStateInterface $form_state) { 473 $new_mail = $form_state->get('mail_change_verification'); 474 if ($new_mail !== NULL) { 475 // Send a verification to the new email address. 476 /** @var \Drupal\user\UserInterface $account */ 477 $account = $this->getEntity(); 478 /** @var \Drupal\user\UserInterface $account_cloned */ 479 $account_cloned = clone $account; 480 $account_cloned->setEmail($new_mail); 481 if (_user_mail_notify('mail_change_verification', $account_cloned) !== NULL) { 482 // Send notification email to the old email address, if it's set. 483 if ($account->getEmail()) { 484 _user_mail_notify('mail_change_notification', $account); 475 // Send a verification to the new email address. 476 /** @var \Drupal\user\UserInterface $account */ 477 $account = $this->getEntity(); 478 /** @var \Drupal\user\UserInterface $account_cloned */ 479 $account_cloned = clone $account; 480 $account_cloned->setEmail($new_mail); 481 if (_user_mail_notify('mail_change_verification', $account_cloned) !== NULL) { 482 // Send notification email to the old email address, if it's set. 483 if ($account->getEmail()) { 484 _user_mail_notify('mail_change_notification', $account); 485 } 486 $this->messenger()->addWarning($this->t('You must confirm your email address. Further instructions have been sent to your new email address.')); 487 } else { 488 // Process change immediately if no verification email is configured. 489 $account->setEmail($new_mail); 490 $account->save(); 466 * 467 * @param array $form 468 * An associative array containing the structure of the form. 469 * @param \Drupal\Core\Form\FormStateInterface $form_state 470 * The current state of the form. 471 */ 472 public function notify(array &$form, FormStateInterface $form_state) { 473 $new_mail = $form_state->get('mail_change_verification'); 474 if ($new_mail !== NULL) { 475 // Send a verification to the new email address. 476 /** @var \Drupal\user\UserInterface $account */ 477 $account = $this->getEntity(); 478 /** @var \Drupal\user\UserInterface $account_cloned */ 479 $account_cloned = clone $account; 480 $account_cloned->setEmail($new_mail); 481 if (_user_mail_notify('mail_change_verification', $account_cloned) !== NULL) { This email send should only happen happen if:
- The account is not new
- The user is not an admin
- Email verification is turned on
- The email address actually changed (might cover case #1)
426 435 * {@inheritdoc} 427 436 */ 428 437 public function submitForm(array &$form, FormStateInterface $form_state) { 438 /** @var \Drupal\user\UserInterface $account */ 439 $account = $this->getEntity(); 440 $new_mail = $form_state->getValue('mail'); 441 $old_mail = $account->getEmail(); 442 443 $own_account = $this->currentUser()->id() === $account->id(); added 611 commits
-
2138aaff...4bb9f46b - 610 commits from branch
project:9.3.x
- ae92d305 - Merge remote-tracking branch 'origin/9.3.x' into 85494-use-email-verification-9.3.x
-
2138aaff...4bb9f46b - 610 commits from branch
Please register or sign in to reply