Loading core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php +5 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,11 @@ class LocaleTranslatedSchemaDefinitionTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected bool $useOneTimeLoginLinks = FALSE; /** * {@inheritdoc} */ Loading core/modules/user/tests/src/Functional/UserLoginTest.php +7 −1 Original line number Diff line number Diff line Loading @@ -169,7 +169,13 @@ public function testPasswordRehashOnLogin(): void { $this->assertTrue($password_hasher->needsRehash($account->getPassword())); $account->passRaw = $password; $this->drupalLogin($account); $this->drupalGet('user/login'); $edit = [ 'name' => $account->getAccountName(), 'pass' => $account->passRaw, ]; $this->submitForm($edit, 'Log in'); // Load the stored user, which should have a different password hash now. $user_storage->resetCache([$account->id()]); $account = $user_storage->load($account->id()); Loading core/modules/user/tests/src/Functional/UserTokenReplaceTest.php +5 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,11 @@ class UserTokenReplaceTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected bool $useOneTimeLoginLinks = FALSE; /** * {@inheritdoc} */ Loading core/modules/user/user.module +1 −1 Original line number Diff line number Diff line Loading @@ -521,7 +521,7 @@ function user_user_logout(AccountInterface $account) { * they can change their password. */ function user_pass_reset_url($account, $options = []) { $timestamp = \Drupal::time()->getRequestTime(); $timestamp = \Drupal::time()->getCurrentTime(); $langcode = $options['langcode'] ?? $account->getPreferredLangcode(); return Url::fromRoute('user.reset', [ Loading core/tests/Drupal/Tests/UiHelperTrait.php +20 −5 Original line number Diff line number Diff line Loading @@ -28,6 +28,11 @@ trait UiHelperTrait { */ protected $loggedInUser = FALSE; /** * Use one-time login links instead of submitting the login form. */ protected bool $useOneTimeLoginLinks = TRUE; /** * The number of meta refresh redirects to follow, or NULL if unlimited. * Loading Loading @@ -156,11 +161,21 @@ protected function drupalLogin(AccountInterface $account) { $this->drupalLogout(); } if ($this->useOneTimeLoginLinks) { // Reload to get latest login timestamp. $storage = \Drupal::entityTypeManager()->getStorage('user'); /** @var \Drupal\user\UserInterface $accountUnchanged */ $accountUnchanged = $storage->loadUnchanged($account->id()); $login = user_pass_reset_url($accountUnchanged) . '/login?destination=user/' . $account->id(); $this->drupalGet($login); } else { $this->drupalGet(Url::fromRoute('user.login')); $this->submitForm([ 'name' => $account->getAccountName(), 'pass' => $account->passRaw, ], 'Log in'); } // @see ::drupalUserIsLoggedIn() $account->sessionId = $this->getSession()->getCookie(\Drupal::service('session_configuration')->getOptions(\Drupal::request())['name']); Loading Loading
core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php +5 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,11 @@ class LocaleTranslatedSchemaDefinitionTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected bool $useOneTimeLoginLinks = FALSE; /** * {@inheritdoc} */ Loading
core/modules/user/tests/src/Functional/UserLoginTest.php +7 −1 Original line number Diff line number Diff line Loading @@ -169,7 +169,13 @@ public function testPasswordRehashOnLogin(): void { $this->assertTrue($password_hasher->needsRehash($account->getPassword())); $account->passRaw = $password; $this->drupalLogin($account); $this->drupalGet('user/login'); $edit = [ 'name' => $account->getAccountName(), 'pass' => $account->passRaw, ]; $this->submitForm($edit, 'Log in'); // Load the stored user, which should have a different password hash now. $user_storage->resetCache([$account->id()]); $account = $user_storage->load($account->id()); Loading
core/modules/user/tests/src/Functional/UserTokenReplaceTest.php +5 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,11 @@ class UserTokenReplaceTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected bool $useOneTimeLoginLinks = FALSE; /** * {@inheritdoc} */ Loading
core/modules/user/user.module +1 −1 Original line number Diff line number Diff line Loading @@ -521,7 +521,7 @@ function user_user_logout(AccountInterface $account) { * they can change their password. */ function user_pass_reset_url($account, $options = []) { $timestamp = \Drupal::time()->getRequestTime(); $timestamp = \Drupal::time()->getCurrentTime(); $langcode = $options['langcode'] ?? $account->getPreferredLangcode(); return Url::fromRoute('user.reset', [ Loading
core/tests/Drupal/Tests/UiHelperTrait.php +20 −5 Original line number Diff line number Diff line Loading @@ -28,6 +28,11 @@ trait UiHelperTrait { */ protected $loggedInUser = FALSE; /** * Use one-time login links instead of submitting the login form. */ protected bool $useOneTimeLoginLinks = TRUE; /** * The number of meta refresh redirects to follow, or NULL if unlimited. * Loading Loading @@ -156,11 +161,21 @@ protected function drupalLogin(AccountInterface $account) { $this->drupalLogout(); } if ($this->useOneTimeLoginLinks) { // Reload to get latest login timestamp. $storage = \Drupal::entityTypeManager()->getStorage('user'); /** @var \Drupal\user\UserInterface $accountUnchanged */ $accountUnchanged = $storage->loadUnchanged($account->id()); $login = user_pass_reset_url($accountUnchanged) . '/login?destination=user/' . $account->id(); $this->drupalGet($login); } else { $this->drupalGet(Url::fromRoute('user.login')); $this->submitForm([ 'name' => $account->getAccountName(), 'pass' => $account->passRaw, ], 'Log in'); } // @see ::drupalUserIsLoggedIn() $account->sessionId = $this->getSession()->getCookie(\Drupal::service('session_configuration')->getOptions(\Drupal::request())['name']); Loading