public function postToken(Request $request)
    {
        $this->validate($request, ['token' => 'required']);

        if (! session('spark:auth:id')) {
            return redirect('login');
        }

        $model = config('auth.model');

        $user = (new $model)->findOrFail(
            $request->session()->pull('spark:auth:id')
        );

        if (Spark::twoFactorProvider()->tokenIsValid($user, $request->token)) {
            Auth::login($user);

            return redirect()->intended($this->redirectPath());
        } else {
            return back();
        }
    }
public function postToken(Request $request)
    {
        $this->validate($request, ['token' => 'required']);

        if (! session('spark:auth:id')) {
            return redirect('login');
        }

        $model = config('auth.model');

        $user = (new $model)->findOrFail(
            $request->session()->pull('spark:auth:id')
        );

        if (Spark::twoFactorProvider()->tokenIsValid($user, $request->token)) {
            Auth::login($user);

            return redirect()->intended($this->redirectPath());
        } else {
            return back();
        }
    }
public function postToken ( Request $ request ) { $ this -> validate ( $ request , [ 'token' => 'required' ] ) ; if ( ! session ( 'spark:auth:id' ) ) { return redirect ( 'login' ) ; } $ model = config ( 'auth.model' ) ; $ user = ( new $ model ) -> findOrFail ( $ request -> session ( ) -> pull ( 'spark:auth:id' ) ) ; if ( Spark :: twoFactorProvider ( ) -> tokenIsValid ( $ user , $ request -> token ) ) { Auth :: login ( $ user ) ; return redirect ( ) -> intended ( $ this -> redirectPath ( ) ) ; } else { return back ( ) ; } }
Verify the two-factor authentication token.

@param  \Illuminate\Http\Request  $request
@return \Illuminate\Http\Response
Verify the two - factor authentication token .