diff --git a/core/modules/user/config/install/user.settings.yml b/core/modules/user/config/install/user.settings.yml index 677add0..ca46109 100644 --- a/core/modules/user/config/install/user.settings.yml +++ b/core/modules/user/config/install/user.settings.yml @@ -14,5 +14,6 @@ notify: register: visitors cancel_method: user_cancel_block password_reset_timeout: 86400 +mail_change_timeout: 86400 password_strength: true langcode: en diff --git a/core/modules/user/config/schema/user.schema.yml b/core/modules/user/config/schema/user.schema.yml index 40a8475..206a853 100644 --- a/core/modules/user/config/schema/user.schema.yml +++ b/core/modules/user/config/schema/user.schema.yml @@ -53,6 +53,9 @@ user.settings: password_reset_timeout: type: integer label: 'Password reset timeout' + mail_change_timeout: + type: integer + label: 'Mail change timeout' password_strength: type: boolean label: 'Enable password strength indicator' diff --git a/core/modules/user/src/Controller/MailChangeController.php b/core/modules/user/src/Controller/MailChangeController.php index 14649e3..f3fc66d 100644 --- a/core/modules/user/src/Controller/MailChangeController.php +++ b/core/modules/user/src/Controller/MailChangeController.php @@ -30,7 +30,7 @@ class MailChangeController extends ControllerBase { * An HTTP response doing a redirect. */ public function page(UserInterface $user, $new_mail, $timestamp, $hash) { - $timeout = Settings::get('mail_change_timeout', 86400); + $timeout = $this->config('user.settings')->get('mail_change_timeout'); /** @var \Drupal\Core\Session\AccountProxyInterface $current_user */ $current_user = $this->currentUser(); $request_time = \Drupal::time()->getRequestTime(); diff --git a/core/modules/user/src/Tests/Update/UpdateMailChangeTest.php b/core/modules/user/src/Tests/Update/UpdateMailChangeTest.php index f5098e9..2ae57f1 100644 --- a/core/modules/user/src/Tests/Update/UpdateMailChangeTest.php +++ b/core/modules/user/src/Tests/Update/UpdateMailChangeTest.php @@ -33,6 +33,7 @@ public function testMailChangeUpdate() { // Check that mail change notifications settings are not set. $this->assertNull($user_settings->get('notify.mail_change_notification')); $this->assertNull($user_settings->get('notify.mail_change_verification')); + $this->assertNull($user_settings->get('mail_change_timeout')); // Check that mail change configurations are not set. $this->assertNull($user_mail->get('mail_change_notification')); @@ -52,6 +53,8 @@ public function testMailChangeUpdate() { // Check that mail change configurations were set to default values. $this->assertIdentical($user_mail->get('mail_change_notification'), $config['mail_change_notification']); $this->assertIdentical($user_mail->get('mail_change_verification'), $config['mail_change_verification']); + // Check that mail change timeout was set. + $this->assertIdentical($user_settings->get('mail_change_timeout'), 86400); } } diff --git a/core/modules/user/user.post_update.php b/core/modules/user/user.post_update.php index 1d87003..43461fb 100644 --- a/core/modules/user/user.post_update.php +++ b/core/modules/user/user.post_update.php @@ -19,6 +19,7 @@ function user_post_update_mail_change() { $config_factory->getEditable('user.settings') ->set('notify.mail_change_notification', FALSE) ->set('notify.mail_change_verification', FALSE) + ->set('mail_change_timeout', 86400) ->save(); $mail_change_notification = [