Problem/Motivation

The request listener of the maintenance mode subscriber of the user module currently runs before routing and therefore relies on the _system_path request attribute. However, the listener is not only acting on maintenance mode, but is additionally responsible for redirecting authenticated users hitting user/login and user/register to user/[uid] and user/[uid]/edit respectively. Currently the redirection needs to happen before routing/access-check, otherwise users will end up on a 403 page.

It is possible to solve this dilemma by splitting out the redirection to an exception subscriber which acts on AccessDeniedHttpException. As a result the priority of the maintenance mode subscriber can be lowered such that it fires after routing.

Proposed resolution

  1. Change priority of \Drupal\user\EventSubscriber\MaintenanceModeSubscriber::onKernelRequestMaintenance()
  2. such that it runs after routing

  3. Perform redirection for authenticated users on the user.login and user.register route in a newly introduced KernelEvents::EXCEPTION
  4. Modify the \Drupal\user\Access\LoginStatusCheck such that it actually respects the boolean argument to the _user_is_logged_in route requirement.
  5. Deny access to authenticated users on user.login

Remaining tasks

User interface changes

API changes

CommentFileSizeAuthor
#63 2288911-use-route-instead-of-system-path-in-user-63.diff15.48 KBznerol
#63 interdiff.txt503 bytesznerol
#62 2288911-use-route-instead-of-system-path-in-user-62.diff15.2 KBznerol
#62 interdiff.txt4.42 KBznerol
#58 interdiff.txt3.06 KBeffulgentsia
#58 2288911-use-route-instead-of-system-path-in-user-58.diff14.64 KBeffulgentsia
#54 2288911-use-route-instead-of-system-path-in-user-53.diff11.04 KBznerol
#52 interdiff.txt1.21 KBznerol
#52 2288911-use-route-instead-of-system-path-in-user-52.diff20.64 KBznerol
#51 interdiff.txt1.22 KBznerol
#51 2288911-use-route-instead-of-system-path-in-user-51.diff20.62 KBznerol
#49 2288911-use-route-instead-of-system-path-in-user-49.diff20.65 KBznerol
#47 2288911-use-route-instead-of-system-path-in-user-47.diff22.97 KBznerol
#45 interdiff.txt798 bytesznerol
#45 2288911-use-route-instead-of-system-path-in-user-45.diff21.16 KBznerol
#41 2288911-use-route-instead-of-system-path-in-user-41.diff20.33 KBznerol
#39 2288911-use-route-instead-of-system-path-in-user-39.diff20.29 KBznerol
#37 2288911-use-route-instead-of-system-path-in-user-37.diff20.29 KBznerol
#35 interdiff.txt6.93 KBznerol
#35 2288911-use-route-instead-of-system-path-in-user-34.diff20.27 KBznerol
#31 interdiff.txt550 bytesznerol
#31 2288911-use-route-instead-of-system-path-in-user-31.diff14.73 KBznerol
#29 2288911-use-route-instead-of-system-path-in-user-29.diff14.77 KBznerol
#29 interdiff.txt1.08 KBznerol
#27 interdiff.txt951 bytesznerol
#27 2288911-use-route-instead-of-system-path-in-user-27.diff13.68 KBznerol
#25 2288911-use-route-instead-of-system-path-in-user-25.diff12.74 KBznerol
#21 2288911-use-route-instead-of-system-path-in-user-20.diff13.7 KBznerol
#15 interdiff.txt2.15 KBznerol
#15 2288911-use-route-instead-of-system-path-in-user-15.diff13.58 KBznerol
#13 interdiff.txt738 bytesznerol
#13 2288911-use-route-instead-of-system-path-in-user-12.diff14.9 KBznerol
#11 interdiff.txt8.84 KBznerol
#11 2288911-use-route-instead-of-system-path-in-user-10.diff14.87 KBznerol
#8 interdiff.txt7.45 KBznerol
#8 2288911-use-route-instead-of-system-path-in-user-8.diff11.57 KBznerol
#7 interdiff.txt4.31 KBznerol
#7 2288911-use-route-instead-of-system-path-in-user-7.diff11.6 KBznerol
#4 interdiff.txt1.62 KBznerol
#4 2288911-use-route-instead-of-system-path-in-user-4.diff11.15 KBznerol
#1 2288911-use-route-instead-of-system-path-in-user.diff9.53 KBznerol
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

znerol’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
9.53 KB
znerol’s picture

Status: Needs review » Needs work

The last submitted patch, 1: 2288911-use-route-instead-of-system-path-in-user.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
11.15 KB
1.62 KB

Interesting test failures. Apparently this change results in the authentication being triggered after routing now. Therefore we need to cherry-pick one of the changes from #2286971: Remove dependency of current_user on request and authentication manager and ensure that it behaves like the AuthenticationEnhancer (only allow default authentication provider if _auth route option was set).

sun’s picture

  1. +++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php
    @@ -88,8 +88,23 @@ public function authenticate(Request $request) {
    +    // @todo: Currently it is necessary to replicate the behavior of
    +    // AuthenticationEnhancer here, and restrict allowed providers to the
    +    // default one, if none was specified on the _auth option. This restriction
    +    // will be removed by https://www.drupal.org/node/2286971
    
    @todo Duplicates AuthenticationEnhancer by reducing providers to the default one if no _auth was specified.
    @see https://www.drupal.org/node/2286971
    
  2. +++ b/core/modules/user/src/EventSubscriber/ExceptionRedirectSubscriber.php
    @@ -0,0 +1,81 @@
    +      if ($route_name == 'user.login') {
    +        // If user is logged in, redirect to 'user' instead of giving 403.
    +        $event->setResponse(new RedirectResponse($this->urlGenerator->generateFromPath('user', array('absolute' => TRUE))));
    

    Shouldn't this redirect to the full /user/123 entity URI/path instead of the /user alias?

  3. +++ b/core/modules/user/src/EventSubscriber/ExceptionRedirectSubscriber.php
    @@ -0,0 +1,81 @@
    +        return;
    ...
    +        return;
    

    Let's replace these early-returns with elseif

  4. +++ b/core/modules/user/user.services.yml
    @@ -40,6 +40,11 @@ services:
    +  user_exception_redirect_subscriber:
    +    class: Drupal\user\EventSubscriber\ExceptionRedirectSubscriber
    

    Don't we have a better naming pattern for such services? E.g.,

    user.routing.exception_subscriber

    ?

    Also, the aspect of "redirect" is rather meaningless in the service ID + class name... Should reference the context of "account" instead.

znerol’s picture

Thanks for the review, will address 1...3 on my way home. Two questions:

  1. We probably should use the route instead of the path when generating the URL. Given that there is UrlGenerator::generate() (Symfony) and UrlGenerator::generateFromRoute() (Drupal) which one is preferred?
  2. I feel that we somewhat abuse the exception subscriber here, that's why I've included the redirect term in the class/service. Originally I even omitted exception at all (i.e. RedirectSubscriber). We do not really handle exceptions here, but sort of gracefully handle a 403. I feel that the fact that it is necessary to catch an AccessDeniedException in order to handle the 403 gracefully is an implementation detail. How about RedirectOn403Subscriber or AccessDenialSubscriber?
znerol’s picture

Addresses #5 1...3, also uses the new RouteMatch class.

znerol’s picture

Rename ExceptionRedirectSubscriber to AccessDeniedSubscriber.

effulgentsia’s picture

This patch looks great. Just some nits:

  1. +++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php
    @@ -88,8 +88,22 @@ public function authenticate(Request $request) {
    +    // If authentication is triggered after routing, restrict the allowed
    +    // providers to the ones specified in the routes _auth option.
    +    //
    +    // @todo Duplicates AuthenticationEnhancer by reducing providers to the
    +    // default one if no _auth was specified. This restriction will be removed
    +    // by https://www.drupal.org/node/2286971
    

    Even after reading this comment, I don't get why this is necessary. What's the flow that this patch changes that results in AuthenticationEnhancer not running or not running at the right time?

  2. +++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
    @@ -0,0 +1,96 @@
    +   * @param \Drupal\Core\Session\AccountInterface $account
    +   *   The current user.
    +   */
    +  public function __construct(AccountInterface $account, URLGeneratorInterface $url_generator) {
    

    Missing @param.

  3. +++ b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -19,7 +20,7 @@
    -   * Determine whether the page is configured to be offline.
    +   * Logout users if site is in maintenance mode.
    

    The doc is an improvement, but still doesn't capture everything the function does.

  4. +++ b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -28,7 +29,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
    +    $route_name = $request->attributes->get(RouteObjectInterface::ROUTE_NAME);
    

    Could use RouteMatch here?

znerol’s picture

Thanks for the review @effulgentsia.

  1. Extracted the logic to a separate method (such that it can be reused from AuthenticationManager::handleException() also).
  2. Fixed.
  3. I've eliminated the redirect from 'user' to 'user/login' for anonymous users and #2288665: Remove _maintenance request attribute and replace it with a maintenance mode service will remove the rest of the function besides the unprivileged users being logged out.
  4. Sure.

Perhaps we could merge this patch into #2288665: Remove _maintenance request attribute and replace it with a maintenance mode service, they are overlapping quite a bit in the user maintenance mode subscriber. Opinions?

znerol’s picture

Status: Needs review » Needs work

The last submitted patch, 11: 2288911-use-route-instead-of-system-path-in-user-10.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
14.9 KB
738 bytes

Status: Needs review » Needs work

The last submitted patch, 13: 2288911-use-route-instead-of-system-path-in-user-12.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
13.58 KB
2.15 KB

Several tests expect that the login-form is at /user instead of /user/login. We should fix this in another issue.

tim.plunkett’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/user/src/Controller/UserController.php
    @@ -26,18 +26,20 @@ class UserController extends ControllerBase {
    +      $response = $this->redirect('user.view', array('user' => $user->id()));
    

    This change doesn't seem like it does anything, it just means an extra call to ->id(), why?

  2. +++ b/core/modules/user/src/Controller/UserController.php
    @@ -26,18 +26,20 @@ class UserController extends ControllerBase {
    -      return $this->redirect('user.login');
    +      $form_builder = $this->formBuilder();
    +      $response = $form_builder->getForm('Drupal\user\Form\UserLoginForm');
    

    This was a very specific behavior in D7 that we were replicating

  3. +++ b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -42,8 +42,12 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
    +            $event->setResponse(new RedirectResponse(url('user/login', array('absolute' => TRUE))));
    

    Whaaaat. Why are you using url() with a path here?

znerol’s picture

Status: Needs work » Needs review

@tim.plunkett: The interdiff in #15 does not show any code which is newly introduced by this patch. It is merely a partial rollback of #10 because fixing the user to user/login redirect involves changing unrelated tests which is definitely not in the scope of this issue.

tim.plunkett’s picture

LOL. I have flashbacks to writing that user login code, and I tried about 5 ways before coming up with whatever is in there, so I was nervous we were changing it. I didn't realize it was a revert :D

xjm’s picture

Priority: Normal » Major
Issue tags: +beta target
znerol’s picture

dawehner’s picture

  1. +++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php
    @@ -155,6 +155,36 @@ public function getSortedProviders() {
    +   * @param Request $request
    

    Can we make this typehint absolute? 1354 will tell you about that.

  2. +++ b/core/modules/user/src/Access/LoginStatusCheck.php
    @@ -27,8 +30,10 @@ class LoginStatusCheck implements AccessInterface {
    +    $required_status = filter_var($route->getRequirement('_user_is_logged_in'), FILTER_VALIDATE_BOOLEAN);
    

    Interesting but let's be honest == 'TRUE' is way easier to read, isn't it?

  3. +++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
    @@ -0,0 +1,98 @@
    +class AccessDeniedSubscriber implements EventSubscriberInterface {
    ...
    +   * Constructs a new redirect subscriber.
    

    Let's fix the docs.

  4. +++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
    @@ -0,0 +1,98 @@
    +
    +  /**
    +   * Generates a URL or path for a specific route based on the given parameters.
    +   *
    +   * @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for
    +   *   details on the arguments, usage, and possible exceptions.
    +   *
    +   * @return string
    +   *   The generated URL for the given route.
    +   *
    +   * @todo: Use UrlGeneratorTrait (see https://www.drupal.org/node/2282161)
    +   */
    +  protected function url($route_name, $route_parameters = array(), $options = array()) {
    +    return $this->urlGenerator->generateFromRoute($route_name, $route_parameters, $options);
    +  }
    +
    

    Let's use the generator as written in the todo

  5. +++ b/core/modules/user/src/RegisterForm.php
    @@ -40,11 +40,6 @@ public function form(array $form, array &$form_state) {
     
    -    // If we aren't admin but already logged on, go to the user page instead.
    -    if (!$admin && $user->isAuthenticated()) {
    -      return new RedirectResponse(url('user/' . \Drupal::currentUser()->id(), array('absolute' => TRUE)));
    -    }
    

    It is great that we can remove that

Status: Needs review » Needs work

The last submitted patch, 21: 2288911-use-route-instead-of-system-path-in-user-20.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
12.74 KB

Reroll of #21, review in #22 not yet addressed.

Status: Needs review » Needs work

The last submitted patch, 25: 2288911-use-route-instead-of-system-path-in-user-25.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
13.68 KB
951 bytes

Test failures from #25 reveal a rather interesting problem. The following hunk is responsible that users are not authenticated unconditionally on every request:

+++ b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
@@ -66,31 +66,19 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
-    if ($this->account->isAuthenticated()) {
-      if ($path == 'user/login') {
-        // If user is logged in, redirect to 'user' instead of giving 403.
-        $event->setResponse(new RedirectResponse(url('user', array('absolute' => TRUE))));
-        return;
-      }
-      if ($path == 'user/register') {
-        // Authenticated user should be redirected to user edit page.
-        $event->setResponse(new RedirectResponse(url('user/' . $this->account->id() . '/edit', array('absolute' => TRUE))));
-        return;
-      }
-    }

Removal of the call to AccountProxy::isAuthenticated() leads to some requests (e.g. Ajax) not being authenticated at all. Because of the tight coupling of the authentication manager and session manager, this means that the session does not get initialized. However the CSRF token stores the token seed in the session and therefore it needs to be initialized beforehand.

Regrettably it is not possible to inject the session manager service into the form builder, because that would break the installer.

Note to self: review in #22 still not addressed.

Status: Needs review » Needs work

The last submitted patch, 27: 2288911-use-route-instead-of-system-path-in-user-27.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
1.08 KB
14.77 KB

We need to mock an introspectable container for the form builder test now.

Status: Needs review » Needs work

The last submitted patch, 29: 2288911-use-route-instead-of-system-path-in-user-29.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
14.73 KB
550 bytes

Restore use statement in form builder test...

Crell’s picture

  1. +++ b/core/lib/Drupal/Core/Form/FormBuilder.php
    @@ -314,6 +314,9 @@ public function rebuildForm($form_id, FormStateInterface &$form_state, $old_form
    +      if (\Drupal::getContainer()->initialized('session_manager')) {
    +        \Drupal::getContainer()->get('session_manager')->startLazy();
    +      }
    

    I don't get why this is needed. If we have to pollute the FormBuilder with a Drupal:: call it should be documented with why.

  2. +++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
    @@ -0,0 +1,98 @@
    +class AccessDeniedSubscriber implements EventSubscriberInterface {
    

    I like this class.

  3. +++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
    @@ -0,0 +1,98 @@
    +      switch ($route_name) {
    +        case 'user.login';
    +          // Redirect an authenticated user to the profile page.
    +          $event->setResponse(new RedirectResponse($this->url('user.view', array('user' => $this->account->id()), array('absolute' => TRUE))));
    +          break;
    +
    +        case 'user.register';
    +          // Redirect an authenticated user to the profile form.
    +          $event->setResponse(new RedirectResponse($this->url('user.edit', array('user' => $this->account->id()), array('absolute' => TRUE))));
    +          break;
    +      }
    +    }
    

    Nitpick: If we're already making a utility method for url() here, the only thing that varies at all between these two is the route name. May as well move the entire RedirectResponse creation to the method, too. (Not a commit blocker at all, just some tidying that can be done.)

Status: Needs review » Needs work

The last submitted patch, 31: 2288911-use-route-instead-of-system-path-in-user-31.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
20.27 KB
6.93 KB

The introduction of #2328777: Refactor FAPI getCache()/setCache() into a standalone class made it possible to remove the \Drupal::getContainer()->get('session_manager')->startLazy(); in the form builder. Instead we just can swap out the form-cache instance in the installer.

Status: Needs review » Needs work

The last submitted patch, 35: 2288911-use-route-instead-of-system-path-in-user-34.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
20.29 KB

Rerolled after the stackphp patch, let's see how this fails today.

Status: Needs review » Needs work

The last submitted patch, 37: 2288911-use-route-instead-of-system-path-in-user-37.diff, failed testing.

znerol’s picture

Status: Needs review » Needs work

The last submitted patch, 39: 2288911-use-route-instead-of-system-path-in-user-39.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
20.33 KB

Reroll.

znerol’s picture

Test failures are still due to the reasons explained in #27. That will be resolved by #2229145: Register symfony session components in the DIC and inject the session service into the request object, which is currently blocked on #2230121: Remove exit() from FormBuilder.

If we do not want to wait for the other issues, it would be possible to fix this by triggering authentication just before access is checked:

diff --git a/core/lib/Drupal/Core/Routing/AccessAwareRouter.php b/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
index 3ca0c1e..8b5cf1e 100644
--- a/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
+++ b/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
@@ -101,6 +101,7 @@ public function matchRequest(Request $request) {
    *   The request to access check.
    */
   protected function checkAccess(Request $request) {
+    \Drupal::currentUser()->getAccount();
     if (!$this->accessManager->checkRequest($request, $this->account)) {
       throw new AccessDeniedHttpException();
     }

Status: Needs review » Needs work

The last submitted patch, 41: 2288911-use-route-instead-of-system-path-in-user-41.diff, failed testing.

Crell’s picture

I hate the idea of such a call, but I hate blocking this on 2 other non-trivial issues more. :-) If we add such a force-login then we would need it documented with a @todo.

I would normally insist on injecting the current_user service, but for a temp hack I may be persuaded that it's better to leave it. IFF we are certain the hack will be removed before 8.0.0.

znerol’s picture

Status: Needs work » Needs review
FileSize
21.16 KB
798 bytes

Reroll, added the hack proposed in #42.

Status: Needs review » Needs work

The last submitted patch, 45: 2288911-use-route-instead-of-system-path-in-user-45.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
22.97 KB

Reroll.

Status: Needs review » Needs work

The last submitted patch, 47: 2288911-use-route-instead-of-system-path-in-user-47.diff, failed testing.

Status: Needs review » Needs work

The last submitted patch, 49: 2288911-use-route-instead-of-system-path-in-user-49.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
20.62 KB
1.22 KB

Fix reroll.

znerol’s picture

The last submitted patch, 51: 2288911-use-route-instead-of-system-path-in-user-51.diff, failed testing.

znerol’s picture

Rollback changes to FormCache, I figure those might not be necessary anymore with the workaround introduced in #45.

The last submitted patch, 52: 2288911-use-route-instead-of-system-path-in-user-52.diff, failed testing.

Status: Needs review » Needs work

The last submitted patch, 54: 2288911-use-route-instead-of-system-path-in-user-53.diff, failed testing.

znerol’s picture

effulgentsia’s picture

Status: Needs work » Needs review
FileSize
14.64 KB
3.06 KB

This should fix the remaining test failures without #57.

effulgentsia’s picture

+++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
@@ -67,6 +67,7 @@ protected function setUp() {
+        'link to any page',

FYI: this is needed because of #2371863: SiteInformationForm validates access to paths that aren't changed, potentially making the form unsubmittable.

catch’s picture

Priority: Major » Critical

Would help resolve #2372507: Remove _system_path from $request->attributes and I think at least the blocking session refactoring issues should be critical.

dawehner’s picture

  1. +++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php
    @@ -177,18 +207,11 @@ public function cleanup(Request $request) {
    +      if ($provider->handleException($event) == TRUE) {
    

    Did you meant === TRUE? Otherwise you can just skip == TRUE entirely.

  2. +++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
    @@ -53,7 +53,20 @@ public function onException(GetResponseForExceptionEvent $event) {
    +            $event->setResponse($this->redirect('entity.user.canonical', array('user' => $this->account->id()), array('absolute' => TRUE)));
    ...
    +            $event->setResponse($this->redirect('entity.user.edit_form', array('user' => $this->account->id()), array('absolute' => TRUE)));
    

    Just curious, do we really need an absolut redirect?

  3. +++ b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -69,25 +69,13 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
       public static function getSubscribedEvents() {
    -    $events[KernelEvents::REQUEST][] = array('onKernelRequestMaintenance', 35);
    +    $events[KernelEvents::REQUEST][] = array('onKernelRequestMaintenance', 31);
         return $events;
       }
    

    +1 to not longer run before routing!

  4. +++ b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
    index be73f39..326adcf 100644
    --- a/core/modules/user/src/RegisterForm.php
    
    --- a/core/modules/user/src/RegisterForm.php
    +++ b/core/modules/user/src/RegisterForm.php
    

    +1 to not hardcode that into the form Note: At least RedirectResponse can now be removed from the use statements, Url is also not used anymore

znerol’s picture

Thanks.

  1. Fixed.
  2. Redirects are always absolute, no need to pass that flag via options.

Also fixed the documentation in user maintenance mode subscriber and removed a stray return from the core maintenance mode subscriber.

znerol’s picture

Also remove spurious use statements.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Alright!

+++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
@@ -17,7 +17,12 @@
- * Redirects anonymous users from user.page to user.login. Redirects authenticated users from login/register form to the profile.
+ * Redirects users when access is denied.
+ *
+ * Anonymous users are taken to the login page when attempting to access the
+ * user profile pages. Authenticated users are redirected from the login form to
+ * their profile page and from the user registration form to their profile edit
+ * form.

Ha, I was shy to mention this :)

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue is a critical task and is allowed per https://www.drupal.org/core/beta-changes. Committed 5ddf7c2 and pushed to 8.0.x. Thanks!

diff --git a/core/lib/Drupal/Core/Routing/AccessAwareRouter.php b/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
index b3033ff..93a31c3 100644
--- a/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
+++ b/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
@@ -90,7 +90,7 @@ public function matchRequest(Request $request) {
     $request->attributes->add($parameters);
     // Trigger a session start and authentication by accessing any property of
     // the current user.
-    // @todo: This can will be removed in #2229145.
+    // @todo This will be removed in https://www.drupal.org/node/2229145.
     $this->account->id();
     $this->checkAccess($request);
     // We can not return $parameters because the access check can change the
diff --git a/core/modules/system/src/Tests/System/PageTitleTest.php b/core/modules/system/src/Tests/System/PageTitleTest.php
index b606b07..98148cd 100644
--- a/core/modules/system/src/Tests/System/PageTitleTest.php
+++ b/core/modules/system/src/Tests/System/PageTitleTest.php
@@ -92,7 +92,7 @@ function testTitleXSS() {
     $this->assertNoRaw($title, 'Check for the lack of the unfiltered version of the title.');
     // Add </title> to make sure we're checking the title tag, rather than the
     // first 'heading' on the page.
-    $this->assertRaw($title_filtered . '</title>', 'Check for the filtered version of the title in a &lt;title&gt; tag.');
+    $this->assertRaw($title_filtered . '</title>', 'Check for the filtered version of the title in a <title> tag.');
 
     // Test the slogan.
     $this->assertNoRaw($slogan, 'Check for the unfiltered version of the slogan.');
diff --git a/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
index 070c5d4..2723074 100644
--- a/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
+++ b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
@@ -58,7 +58,6 @@ public function __construct(MaintenanceModeInterface $maintenance_mode, AccountI
   public function onKernelRequestMaintenance(GetResponseEvent $event) {
     $request = $event->getRequest();
     $route_match = RouteMatch::createFromRequest($request);
-    $route_name = $route_match->getRouteName();
     if ($this->maintenanceMode->applies($route_match)) {
       // If the site is offline, log out unprivileged users.
       if ($this->account->isAuthenticated() && !$this->maintenanceMode->exempt($this->account)) {

Fixed on commit. $route_name is not used in core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php.

  • alexpott committed 5ddf7c2 on 8.0.x
    Issue #2288911 by znerol, effulgentsia: Use route name instead of system...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.