Search code examples
symfonycaptchasymfony-sonatasonata-user-bundle

Sonata Admin + FOS User Bundle - add captcha to login form


I'm looking for a way to add captcha to Sonata User Bundle login form (and the validation of captcha of course!).

I couldn't find literally anything about using captcha in Sonata User Bundle, so I hope someone already been doing that and could perhaps help a bit?

@EDIT

Following Frankbeen's answer I've already extended AdminSecurityController (from sonata user bundle) which does have loginAction (for showing login form) and the form itself.

Unfortunately the captcha is not checked (loginAction is not called once we submit the form). That makes me wonder what's the controller:action used to actually check the submitted form? Maybe it's done via some sort of event listener?


Solution

  • I believe I found the solution. To achieve what I wanted I just had to override UsernamePasswordAuthenticationListener following this answer:

    Adding Captcha to Symfony2 Login Page