You can implement Success Hander.
- Write a class that implements
AuthenticationSuccessHandlerInterface: - ( ,
, ).
, :
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
secured_area:
pattern: ^/
anonymous: ~
form_login:
login_path: login
check_path: login_check
success_handler: some.service.id
logout:
path: logout
target: /
symfony2 ( fail_handler).
onSecurityInteractiveLogin :
public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
{
$user = $event->getAuthenticationToken()->getUser();
$user->setLastLogin(new \Datetime());
$this->em->persist($user);
$this->em->flush();
}