protected function consistentResponseTime($startTime)
    {
        if (!Config::inst()->get('LDAPLoginForm', 'consistent_password_times')) {
            return;
        }

        $timeTaken = microtime(true) - $startTime;
        if ($timeTaken < self::RESPONSE_TIME) {
            $sleepTime = self::RESPONSE_TIME - $timeTaken;
            // usleep takes microseconds, so we times our sleep period by 1mil (1mil ms = 1s)
            usleep($sleepTime * 1000000);
        }

    }
protected function consistentResponseTime($startTime)
    {
        if (!Config::inst()->get('LDAPLoginForm', 'consistent_password_times')) {
            return;
        }

        $timeTaken = microtime(true) - $startTime;
        if ($timeTaken < self::RESPONSE_TIME) {
            $sleepTime = self::RESPONSE_TIME - $timeTaken;
            // usleep takes microseconds, so we times our sleep period by 1mil (1mil ms = 1s)
            usleep($sleepTime * 1000000);
        }

    }
protected function consistentResponseTime ( $ startTime ) { if ( ! Config :: inst ( ) -> get ( 'LDAPLoginForm' , 'consistent_password_times' ) ) { return ; } $ timeTaken = microtime ( true ) - $ startTime ; if ( $ timeTaken < self :: RESPONSE_TIME ) { $ sleepTime = self :: RESPONSE_TIME - $ timeTaken ; // usleep takes microseconds, so we times our sleep period by 1mil (1mil ms = 1s) usleep ( $ sleepTime * 1000000 ) ; } }
Ensures response times are the same across all scenarios i.e. email exists or doesn't
this helps to avoid issues where malicious users could find if an email is legitimate based on response time

@param float $startTime
Ensures response times are the same across all scenarios i . e . email exists or doesn t this helps to avoid issues where malicious users could find if an email is legitimate based on response time