Symfony2: After successful login event, perform set of actions

前端 未结 2 2154
南方客
南方客 2020-11-29 05:20

I need to perform a set of actions after a user successfully logs in. This includes loading data from the database and storing it in the session.

What is the best ap

2条回答
  •  我在风中等你
    2020-11-29 05:46

    You can even fetch the user instance from the event itself, no need to inject the token storage!

    public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
    {
        $event->getAuthenticationToken()->getUser()
    }
    

提交回复
热议问题