REBELinBLUE\Deployer\Http\Controllers\Auth\AuthController::postTwoFactorAuthentication PHP Метод

postTwoFactorAuthentication() публичный Метод

Validates the 2FA code.
public postTwoFactorAuthentication ( Illuminate\Http\Request $request ) : Illuminate\Http\RedirectResponse
$request Illuminate\Http\Request
Результат Illuminate\Http\RedirectResponse
    public function postTwoFactorAuthentication(Request $request)
    {
        $user_id = Session::pull('2fa_user_id');
        $remember = Session::pull('2fa_login_remember');
        if ($user_id) {
            $auth = Auth::guard($this->getGuard());
            $auth->loginUsingId($user_id, $remember);
            if ($this->google2fa->verifyKey($auth->user()->google2fa_secret, $request->get('2fa_code'))) {
                return $this->handleUserWasAuthenticated($request, true);
            }
            $auth->logout();
            return redirect()->route('auth.login')->withError(Lang::get('auth.invalid_code'));
        }
        return redirect()->route('auth.login')->withError(Lang::get('auth.invalid_code'));
    }