Skip to content
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

IsVerified can't protect api routes #97

Closed
osaris opened this issue Jan 9, 2017 · 5 comments
Closed

IsVerified can't protect api routes #97

osaris opened this issue Jan 9, 2017 · 5 comments

Comments

@osaris
Copy link

osaris commented Jan 9, 2017

Hello,

I can't reject API call if user isn't verified by adding the middleware ìsVerified to my api routes because this line

if( ! $request->user()->verified){
fails ($request->user() is null in this case)

Regards

@jrean
Copy link
Owner

jrean commented Jan 15, 2017

@osaris
Copy link
Author

osaris commented Jan 15, 2017

Looking at your commit here 2cdf8fe i think it won't fix my issue because there won't be error anymore but no check is done anymore in the case of an API call ?

@jrean
Copy link
Owner

jrean commented Jan 16, 2017 via email

@osaris
Copy link
Author

osaris commented Jan 16, 2017

Sorry I have no code sample but the problem is that API guard doesn't set $request->user. Your patch doesn't provide an alternative to check if the current $user is verified, it simply doesn't do the check if $user is null.

I wasn't able to find a good code to do check for both web/api guard (and custom user guard ?) user. But the problem is mentionned here for example : laravel/framework#11782 (comment)

@jrean
Copy link
Owner

jrean commented Jan 24, 2017

Sorry I don't understand what is your issue then.
Feel free to provide more details or code sample :-)

@jrean jrean closed this as completed Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants