php - Symfony2 - Show bad credentials error -
I am writing a custom author in Symfony2. Everything works by now, but when I enter the wrong password, an internal server error is displayed: "LDAP authentication failed".
Now, this is the message that I want to display, but I would like to display it above my entry form and not throw internal server error. In my audience, I have the following:
Try {$ authToken = $ this-> authentication manager-> Authenticate ($ token); $ This- & gt; SecurityContext- & gt; setToken ($ authToken); Return; } Hold (authentication exception $ fail) {throw new badcredentialsException ($ fail-> getMessage (), 0); } Anyone can tell me what should I do to send a message to the user, rather than throwing an internal server error?
Thank you in advance.
You can manually add an error to your login form. For example:
$ form-> Receive ('username') - & gt; Junk error (new form error ($ message));
Comments
Post a Comment