summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2018-06-11 17:39:46 (GMT)
committerAlex Pott2018-06-11 17:39:46 (GMT)
commita3bb9d878f66fbae642b7f1a342745c7602641ea (patch)
tree33cfe89059dea5a35a89f5911fca8b5a15aa3821
parent15946fea4304af6ddeac8319b12d62c54f103e19 (diff)
Issue #2855054 by alexpott, LoMo, wesleydv, Artusamak, gawaksh, xjm: User cancel link doesn't redirect to the homepage
-rw-r--r--core/modules/user/src/Controller/UserController.php2
-rw-r--r--core/modules/user/tests/src/Functional/UserCancelTest.php9
2 files changed, 7 insertions, 4 deletions
diff --git a/core/modules/user/src/Controller/UserController.php b/core/modules/user/src/Controller/UserController.php
index eba37a9..2bbfe34 100644
--- a/core/modules/user/src/Controller/UserController.php
+++ b/core/modules/user/src/Controller/UserController.php
@@ -317,7 +317,7 @@ class UserController extends ControllerBase {
// Since user_cancel() is not invoked via Form API, batch processing
// needs to be invoked manually and should redirect to the front page
// after completion.
- return batch_process('');
+ return batch_process('<front>');
}
else {
$this->messenger()->addError($this->t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'));
diff --git a/core/modules/user/tests/src/Functional/UserCancelTest.php b/core/modules/user/tests/src/Functional/UserCancelTest.php
index 503100c..869cd37 100644
--- a/core/modules/user/tests/src/Functional/UserCancelTest.php
+++ b/core/modules/user/tests/src/Functional/UserCancelTest.php
@@ -251,6 +251,12 @@ class UserCancelTest extends BrowserTestBase {
// Confirm account cancellation request.
$this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp));
+ // Confirm that the user was redirected to the front page.
+ $this->assertSession()->addressEquals('');
+ $this->assertSession()->statusCodeEquals(200);
+ // Confirm that the confirmation message made it through to the end user.
+ $this->assertRaw(t('%name has been disabled.', ['%name' => $account->getUsername()]), "Confirmation message displayed to user.");
+
$user_storage->resetCache([$account->id()]);
$account = $user_storage->load($account->id());
$this->assertTrue($account->isBlocked(), 'User has been blocked.');
@@ -266,9 +272,6 @@ class UserCancelTest extends BrowserTestBase {
$storage->resetCache([$comment->id()]);
$comment = $storage->load($comment->id());
$this->assertFalse($comment->isPublished(), 'Comment of the user has been unpublished.');
-
- // Confirm that the confirmation message made it through to the end user.
- $this->assertRaw(t('%name has been disabled.', ['%name' => $account->getUsername()]), "Confirmation message displayed to user.");
}
/**