/** * Determine if the user has too many failed login attempts. * @param Request $request * @return bool */ protected function hasTooManyLoginAttempts(Request $request, Cache $cache) { $attempts = $this->loginAttempts($request); $lockedOut = $cache->has($key = $this->loginLockExpirationKey($request)); if ($attempts > $this->maxLoginAttempts() || $lockedOut) { if (!$lockedOut) { $minutes = round($this->lockOutTimemout() / 60); $cache->put($key, time() + $minutes * 60, $minutes); } return true; } return false; }