public function isTwoFactorAuthFormTimeout($userId=null, $startTime=null ) {

        if (isset($userId)) {

            // User wants to login, performing 2FA for this login
            $startTime = strtotime($this->getUserSmsTokenCreatedAt($userId));
        } else {

            // New front-end registration, performing 2FA for this registration
            $startTime = strtotime($startTime);
        }

        $now       = strtotime(Carbon::now());

        // The time difference is in seconds, we want in minutes
        $timeDiff = ($now - $startTime)/60;

        $minutes2faFormIsLive = config('lasallecmsusermanagement.auth_2fa_minutes_smscode_is_live');

        if ($timeDiff > $minutes2faFormIsLive) {

            if (isset($userId)) {
                // clear out the user's 2FA sms code and timestamp
                $this->clearUserTwoFactorAuthFields($userId);

                // clear the user_id session variable
                $this->clearUserIdSessionVar();
            } else {
                $this->clearTwoFactorAuthCodeToInput();
            }

            return true;
        }

        return false;
    }
public function isTwoFactorAuthFormTimeout($userId=null, $startTime=null ) {

        if (isset($userId)) {

            // User wants to login, performing 2FA for this login
            $startTime = strtotime($this->getUserSmsTokenCreatedAt($userId));
        } else {

            // New front-end registration, performing 2FA for this registration
            $startTime = strtotime($startTime);
        }

        $now       = strtotime(Carbon::now());

        // The time difference is in seconds, we want in minutes
        $timeDiff = ($now - $startTime)/60;

        $minutes2faFormIsLive = config('lasallecmsusermanagement.auth_2fa_minutes_smscode_is_live');

        if ($timeDiff > $minutes2faFormIsLive) {

            if (isset($userId)) {
                // clear out the user's 2FA sms code and timestamp
                $this->clearUserTwoFactorAuthFields($userId);

                // clear the user_id session variable
                $this->clearUserIdSessionVar();
            } else {
                $this->clearTwoFactorAuthCodeToInput();
            }

            return true;
        }

        return false;
    }
public function isTwoFactorAuthFormTimeout ( $ userId = null , $ startTime = null ) { if ( isset ( $ userId ) ) { // User wants to login, performing 2FA for this login $ startTime = strtotime ( $ this -> getUserSmsTokenCreatedAt ( $ userId ) ) ; } else { // New front-end registration, performing 2FA for this registration $ startTime = strtotime ( $ startTime ) ; } $ now = strtotime ( Carbon :: now ( ) ) ; // The time difference is in seconds, we want in minutes $ timeDiff = ( $ now - $ startTime ) / 60 ; $ minutes2faFormIsLive = config ( 'lasallecmsusermanagement.auth_2fa_minutes_smscode_is_live' ) ; if ( $ timeDiff > $ minutes2faFormIsLive ) { if ( isset ( $ userId ) ) { // clear out the user's 2FA sms code and timestamp $ this -> clearUserTwoFactorAuthFields ( $ userId ) ; // clear the user_id session variable $ this -> clearUserIdSessionVar ( ) ; } else { $ this -> clearTwoFactorAuthCodeToInput ( ) ; } return true ; } return false ; }
Has too much time passed between issuing the 2FA code and this code being
entered into the verification form?

@param  int       $userId          User ID --> if null, then called by 2FA registration
@param  datetime  $startTime       Time 2FA form created --> if null, then called by 2FA login
@return bool
Has too much time passed between issuing the 2FA code and this code being entered into the verification form?