1

I'm working with Symfony and FosUserBundle and I need to insert a log in my database if login is ok and before the redirection to my secured area.

I already overrode SecurityController for loginAction, but where can I insert my log ?

I don't think it's in loginAction, but I don't know how can I override login_check ?

Any ideas ?

Clément Andraud
  • 9,103
  • 25
  • 80
  • 158

1 Answers1

2

You can doing the work indirectly with symfony layer framework. If it's good for you that use symfony you can :

  • use the DefaultAuthenticationSuccessHandler class symfony and read this : DefaultAuthenticationSuccessHandler
  • declare a service symfony with function 'onAuthenticationSuccess'

After that you can work with all symfony tools for logging all of you want.

I already use this method with FOSUserBundle.

Community
  • 1
  • 1
miltone
  • 4,416
  • 11
  • 42
  • 76
  • Yeah thanks, I overrode onAuthenticationSuccess and it's ok ! I know it's another question butI have a user in_memory, how can I check if it's a user in_memory in onAuthenticationSuccess ? I don't want to log if it is... – Clément Andraud Jan 14 '16 at 11:09