You are here

public function UserController::userPage in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/src/Controller/UserController.php \Drupal\user\Controller\UserController::userPage()

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 value

\Symfony\Component\HttpFoundation\RedirectResponse Returns a redirect to the profile of the currently logged in user.

1 string reference to 'UserController::userPage'
user.routing.yml in core/modules/user/user.routing.yml
core/modules/user/user.routing.yml

File

core/modules/user/src/Controller/UserController.php, line 278

Class

UserController
Controller routines for user routes.

Namespace

Drupal\user\Controller

Code

public function userPage() {
  return $this
    ->redirect('entity.user.canonical', [
    'user' => $this
      ->currentUser()
      ->id(),
  ]);
}