Airship\Cabin\Bridge\Landing\Account::twoFactorPreamble PHP Method

twoFactorPreamble() protected method

Make sure the secret exists, then get the GoogleAuth object
protected twoFactorPreamble ( integer $userID ) : ParagonIE\MultiFactor\Vendor\GoogleAuth
$userID integer
return ParagonIE\MultiFactor\Vendor\GoogleAuth
    protected function twoFactorPreamble(int $userID = 0) : GoogleAuth
    {
        if (!$userID) {
            $userID = $this->getActiveUserId();
        }
        $secret = $this->acct->getTwoFactorSecret($userID);
        if (empty($secret)) {
            if (!$this->acct->resetTwoFactorSecret($userID)) {
                \Airship\json_response(['test2']);
                \Airship\redirect($this->airship_cabin_prefix);
            }
            $secret = $this->acct->getTwoFactorSecret($userID);
        }
        return new GoogleAuth($secret, new TOTP(0, (int) ($this->config('two-factor.period') ?? 30), (int) ($this->config('two-factor.length') ?? 6)));
    }