diff -u b/core/modules/user/src/Controller/UserController.php b/core/modules/user/src/Controller/UserController.php --- b/core/modules/user/src/Controller/UserController.php +++ b/core/modules/user/src/Controller/UserController.php @@ -126,7 +126,11 @@ } /** - * Redirects an authenticated user to its profile page. + * Redirects users to their profile page. + * + * This controller assumes that it is only invoked for authenticated users. + * This is enforced for the 'user.page' route with the '_user_is_logged_in' + * requirement. * * @return \Symfony\Component\HttpFoundation\RedirectResponse * Returns a redirect to the profile of the currently logged in user. diff -u b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php --- b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php +++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php @@ -63,8 +63,9 @@ * {@inheritdoc} */ public static function getSubscribedEvents() { - // Use a high priority here in order to beat core MaintenanceModeSubscriber - // as well as ExceptionLoggingSubscriber. + // Use a higher priority than + // \Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber, because there's + // no need to log the exception if we can redirect. $events[KernelEvents::EXCEPTION][] = ['onException', 75]; return $events; } diff -u b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php --- b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php +++ b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php @@ -71,12 +71,12 @@ } if ($this->account->isAuthenticated()) { if ($path == 'user/login') { - // If user is logged in, redirect to 'user' instead of giving 403. + // If the user is already logged in, redirect to their profile page. $event->setResponse($this->redirect('entity.user.canonical', ['user' => $this->account->id()])); return; } if ($path == 'user/register') { - // Authenticated user should be redirected to user edit page. + // If the user is already registered, redirect to their edit page. $event->setResponse(new RedirectResponse($this->url('entity.user.edit_form', ['user' => $this->account->id()], ['absolute' => TRUE]))); return; }