jorge07 / symfony-6-es-cqrs-boilerplate

Symfony 6 DDD ES CQRS backend boilerplate.
MIT License
1.07k stars 187 forks source link

Sign-in form returns a JSON response #148

Closed jon-ht closed 4 years ago

jon-ht commented 4 years ago

When I try to log in with an invalid email (like foo), I'm getting an error "Not a valid email" but the response is in JSON

image

Do you have any idea why the AuthenticationException isn't caught by firewall or isn't a basic HttpResponse ?


Edit: I'm trying to log via http://127.0.0.1/sign-in in the web form

cv65kr commented 4 years ago

Hey

If you look at \App\Infrastructure\User\Auth\Guard\LoginAuthenticator::getUser only InvalidCredentialsException is catched and throwed again as AuthenticationException.

Incomming data is validate by Assertion and when fail they throws InvalidArgumentException which is not catched.

Good catch, we need fix this problem.

jorge07 commented 4 years ago

Strange, this is covered here and there's a test for this use case: https://github.com/jorge07/symfony-5-es-cqrs-boilerplate/blob/master/tests/UI/Http/Web/Controller/SignUpControllerTest.php#L50

I tried to reproduce it locally but I can't get this JSON response...

jorge07 commented 4 years ago

Is this a simple clone? No edits?

cv65kr commented 4 years ago

you looked at sign-up but problem is with sign-in 😄

jorge07 commented 4 years ago

🤦 That's why I shouldn't do stuff at 2AM

jorge07 commented 4 years ago

Fixed here https://github.com/jorge07/symfony-5-es-cqrs-boilerplate/pull/149/commits/914eb0c2bac18e3777c20ac871c5fd88b2f3b0af

jorge07 commented 4 years ago

Close as fixed in #149 thanks for report it!

jon-ht commented 4 years ago

Thanks for the quick fix! :)