-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Username in UsernameNotFoundException message data #10427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added username in UsernameNotFoundException message data
|
NOTE: Travis failed because of "Pull Request License Headers". I edited the description so it is there but it probably didn't trigger the PR revalidation. |
|
@maryo Can you add a unit test to cover this change? |
Added unit test
Added newline at the end of UsernameNotFoundExceptionTest.php
|
@fabpot Like this? |
|
Hello @maryo, can you describe the use case for this? |
|
@romainneutron: Just because i want to display a better message to the user. 'User "John Doe" could not be found.' AuthenticationException have getMessageKey() and getMessageData() methods with comment "Message data to be used by the translation component.". These methods are not used in the framework at all. But in my case i have my own AuthenticationFailureHandler which returns JsonResponse (REST API). I use translator to translate the AuthenticationException there. $this->translator->trans($exception->getMessageKey(), $exception->getMessageData(), 'exceptions')BTW i have these methods on some other exceptions too. That's why the translation domain is set to "exceptions". |
|
Then |
|
@romainneutron I can add it but is it a good idea to show the username as a default behavior?... User can easily use the placeholder in translations. That was the point of the PR. |
|
Actually I think that displaying the username by default is not a good practice. I mean, the user know what it enters, and this is probably already displayed in the form. |
|
I agree with @fabpot here |
Added username in UsernameNotFoundException message data