public function lockSignIn()
    {
        $retval = false;

        $nb_session = $this->nb_application->getSession();
        if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND);
        }

        $nb_response = $this->nb_application->getResponse();
        if ($nb_response === null || !($nb_response instanceof CNabuHTTPResponse)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_RESPONSE_NOT_FOUND);
        }

        $nb_site = $this->nb_application->getHTTPServer()->getSite();
        if ($nb_site === null || !($nb_site instanceof CNabuSite)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
        }

        try {
            $lang = $this->nb_application->getRequest()->getLanguage()->getId();
        } catch (Exception $e) {
            $lang = null;
        }
        if ($lang === null) {
            $lang = $nb_site->getDefaultLanguageId();
        }

        $max_signin_retries = $nb_site->getMaxSignInRetries();
        $signin_locked_delay = $nb_site->getSignInLockDelay();
        $signin_retries = $nb_session->getVariable('signin_retries', 0);
        $signin_last_fail_timestamp = $nb_session->getVariable('signin_last_fail_timestamp', 0);
        $now = time() - $signin_last_fail_timestamp;

        if ($max_signin_retries > 0) {
            if ($this->isSignInLocked()) {
            } else {
                $nb_session->setVariable('signin_retries', $signin_retries < $max_signin_retries ? ++$signin_retries : $max_signin_retries);
                $nb_session->setVariable('signin_last_fail_timestamp', time());
            }
            if ($this->isSignInLocked()) {
                if (is_string($link = $nb_site->getLoginMaxFailsTargetLink()->getBestQualifiedURL(array($lang => $lang)))) {
                    $nb_response->redirect($nb_site->getLoginMaxFailsErrorCode(), $link);
                } else {
                    $retval = true;
                }
            }
        }

        return $retval;
    }
public function lockSignIn()
    {
        $retval = false;

        $nb_session = $this->nb_application->getSession();
        if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND);
        }

        $nb_response = $this->nb_application->getResponse();
        if ($nb_response === null || !($nb_response instanceof CNabuHTTPResponse)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_RESPONSE_NOT_FOUND);
        }

        $nb_site = $this->nb_application->getHTTPServer()->getSite();
        if ($nb_site === null || !($nb_site instanceof CNabuSite)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
        }

        try {
            $lang = $this->nb_application->getRequest()->getLanguage()->getId();
        } catch (Exception $e) {
            $lang = null;
        }
        if ($lang === null) {
            $lang = $nb_site->getDefaultLanguageId();
        }

        $max_signin_retries = $nb_site->getMaxSignInRetries();
        $signin_locked_delay = $nb_site->getSignInLockDelay();
        $signin_retries = $nb_session->getVariable('signin_retries', 0);
        $signin_last_fail_timestamp = $nb_session->getVariable('signin_last_fail_timestamp', 0);
        $now = time() - $signin_last_fail_timestamp;

        if ($max_signin_retries > 0) {
            if ($this->isSignInLocked()) {
            } else {
                $nb_session->setVariable('signin_retries', $signin_retries < $max_signin_retries ? ++$signin_retries : $max_signin_retries);
                $nb_session->setVariable('signin_last_fail_timestamp', time());
            }
            if ($this->isSignInLocked()) {
                if (is_string($link = $nb_site->getLoginMaxFailsTargetLink()->getBestQualifiedURL(array($lang => $lang)))) {
                    $nb_response->redirect($nb_site->getLoginMaxFailsErrorCode(), $link);
                } else {
                    $retval = true;
                }
            }
        }

        return $retval;
    }
public function lockSignIn ( ) { $ retval = false ; $ nb_session = $ this -> nb_application -> getSession ( ) ; if ( $ nb_session === null || ! ( $ nb_session instanceof CNabuHTTPSession ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SESSION_NOT_FOUND ) ; } $ nb_response = $ this -> nb_application -> getResponse ( ) ; if ( $ nb_response === null || ! ( $ nb_response instanceof CNabuHTTPResponse ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_RESPONSE_NOT_FOUND ) ; } $ nb_site = $ this -> nb_application -> getHTTPServer ( ) -> getSite ( ) ; if ( $ nb_site === null || ! ( $ nb_site instanceof CNabuSite ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SITE_NOT_FOUND ) ; } try { $ lang = $ this -> nb_application -> getRequest ( ) -> getLanguage ( ) -> getId ( ) ; } catch ( Exception $ e ) { $ lang = null ; } if ( $ lang === null ) { $ lang = $ nb_site -> getDefaultLanguageId ( ) ; } $ max_signin_retries = $ nb_site -> getMaxSignInRetries ( ) ; $ signin_locked_delay = $ nb_site -> getSignInLockDelay ( ) ; $ signin_retries = $ nb_session -> getVariable ( 'signin_retries' , 0 ) ; $ signin_last_fail_timestamp = $ nb_session -> getVariable ( 'signin_last_fail_timestamp' , 0 ) ; $ now = time ( ) - $ signin_last_fail_timestamp ; if ( $ max_signin_retries > 0 ) { if ( $ this -> isSignInLocked ( ) ) { } else { $ nb_session -> setVariable ( 'signin_retries' , $ signin_retries < $ max_signin_retries ? ++ $ signin_retries : $ max_signin_retries ) ; $ nb_session -> setVariable ( 'signin_last_fail_timestamp' , time ( ) ) ; } if ( $ this -> isSignInLocked ( ) ) { if ( is_string ( $ link = $ nb_site -> getLoginMaxFailsTargetLink ( ) -> getBestQualifiedURL ( array ( $ lang => $ lang ) ) ) ) { $ nb_response -> redirect ( $ nb_site -> getLoginMaxFailsErrorCode ( ) , $ link ) ; } else { $ retval = true ; } } } return $ retval ; }
Tries to lock the sign-in. If counter is less than the max, then increases the counter. If elapsed time between
now and last retry failed is great than the max lock delay, then resets the counter.
@return bool Returns true if sign-in is locked.
Tries to lock the sign - in . If counter is less than the max then increases the counter . If elapsed time between now and last retry failed is great than the max lock delay then resets the counter .