Home > Mobile >  Pin Verification In Laravel
Pin Verification In Laravel

Time:10-10

I'm a beginner. I have a pin field in my user database. I want users to verify the pin before they can access there profile. how can I do this any logic?

CodePudding user response:

laravel login using pincode :check the following code example may be you get the hint how to implement that, in this example code pin authentication is done using JWT and then user is allowed to access to those specific routes.

$user = User::find($uid);

try {
    if (!$token = JWTAuth::fromUser($user)) {
        return $this->onUnauthorized();
    }
} catch (JWTException $e) {
    return $this->onJwtGenerationError();
}

CodePudding user response:

For somereason if you dont want to use the above JWT method you can use this one. i'm sharing the code for an example from by program which may help you

$user = User::select('id')->where('pin',$pin)->first();
Auth::loginUsingId($user->id);
return redirect()->intended('/user');
  • Related