/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakedc/users/Docs/Documentation
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakedc/users/Docs/Documentation/InterceptLoginAction.md (1480B)
Intercept Login Action
======================
There is a moment when you may want to intercept the login action to perform
some specific login, like redirect user to another url or set user data.
A simple way to intercept the login action is by creating a custom middleware, the following
example shows how to set user data and redirect to anothe url.
```
checkActionOnRequest('login', $request)) {
return $next($request, $response);
}
if (!$request->getAttribute('session')->read('Auth')) {
//do some logic
//do more logic
$request->getAttribute('session')->write('Auth', $userIdentity);
$response = $response->withHeader('Location', '/pages/33');
return $response;
}
return $next($request, $response);
}
}
```