mohammad-fouladgar / laravel-mobile-verification

This package provides convenient methods for making token code, sending and verifying mobile phone verification requests.
https://medium.com/@mohammadfouladgarphp/laravel-mobile-verification-e330a8fbecfc
MIT License
448 stars 35 forks source link

Verified issue #161

Closed arebuffo closed 4 years ago

arebuffo commented 4 years ago

Hi,

I managed to make it work, it works flawlessly, with my own VueJS SPA, sanctum as the auth, etc.

The only trouble I have is that once I verified the token, the user is not refreshed until the next login. Is this normal? I can't find a way to do it without forcing something.

Thank you

50bhan commented 4 years ago

@arebuffo What do you mean by the user is not refreshed until the next login?

arebuffo commented 4 years ago

Hi,

Sorry about the bad phrasing.

When the user verifies the token successfully, the hasVerifiedMobile() still returns false, unless I logoff and logon again. The routes are still redirected to the verification page.

Alex

arebuffo commented 4 years ago

I think it might be my mistake. I replaced, for the sake of simplicity, the middleware route 'verified':

    'verified' => \App\Http\Middleware\EnsureMobileIsVerified::class,

// 'verified' => \App\Http\Middleware\EnsureEmailIsVerified::class,

and maybe I should include mobile.verified.

mohammad-fouladgar commented 4 years ago

@arebuffo Yes. You should not use it as a middleware globally. Please read this part of the document : https://github.com/mohammad-fouladgar/laravel-mobile-verification#protecting-routes

mohammad-fouladgar commented 4 years ago

You do not need to register EnsureMobileIsVerified middleware, because this has already registered. Also, This is not relate to EnsureEmailIsVerified middleware.

mohammad-fouladgar commented 4 years ago

I'll close this issue, but you can reopen if you need it.