joselfonseca / lighthouse-graphql-passport-auth

Add GraphQL mutations to get tokens from passport for https://lighthouse-php.com/
https://lighthouse-php-auth.com/
MIT License
231 stars 55 forks source link

Throw exception or error instead of custom response on failure to send reset-password email #127

Closed FreekVR closed 3 years ago

FreekVR commented 3 years ago

When sending the reset password e-mail fails, currently the following JSON response is sent back as graphql data:

return [
            'status'  => 'EMAIL_NOT_SENT',
            'message' => __($response),
        ];

I would suggest throwing an Exception or Error here, which will be formatted by lighthouse according to the GraphQL spec, which would help in a frontend app that only responds to this errors object to show errors by default. Currently I'd have to add a custom front-end handler for this use case to show feedback to the user.

joselfonseca commented 3 years ago

This is a good catch. For some reason I though I did that already. I'll make it happen. Thanks @FreekVR

joselfonseca commented 3 years ago

https://github.com/joselfonseca/lighthouse-graphql-passport-auth/releases/tag/5.2.1

FreekVR commented 3 years ago

That was quick -- thanks :)!