how to redirect user after login
here my code but not working with login
here my Authentication Componen
$this->loadComponent(‘Authentication.Authentication’, [
‘loginRedirect’ => ‘/web/user/siteuser’,
‘logoutRedirect’ => ‘/user/login’, // Default is false
‘unauthenticatedRedirect’ => [
‘Plugin’ => false,
‘prefix’ => false,
‘controller’ => ‘user’,
‘action’ => ‘login’
]
]);
HereMy Login Action
$result = $this->Authentication->getResult(); debug($result); // regardless of POST or GET, redirect if user is logged in if ($result->isValid()) { $redirect = $this->request->getQuery('redirect', [ 'plugin' => 'CoreDev', 'Prefix' => 'User', 'controller' => 'Siteuser', 'action' => 'index' ]); return $this->redirect($redirect); }