public function failLogin($username, $password)
    {
        $ipFailed = false;
        $userFailed = false;

        // Track both failed logins from this IP and attempts to login to this user account
        $this->ipService->logFailedLogin();
        $this->loginAttemptService->trackAttempt($username, $password);

        // Deal with excessive logins from an IP
        if ($this->ipService->failedLoginsThresholdReached()) {
            $this->ipService->addToBlacklistForThresholdReached();
            $ipFailed = true;
        }

        // If the remaining attempts are less than 0
        if ($this->loginAttemptService->remainingAttempts($username, $password) <= 0) {
            $this->loginAttemptService->deactivate($username);
            $userFailed = true;
        }

        // Throw the IP ban error if we hit both ip limit and user limit at the same time
        if ($ipFailed) {
            $message = $this->ipService->getErrorMessage();
            throw new FailedLoginThresholdExceededException($message);
        }

        // If the user has been automatically deactivated and the IP has not been banned
        if ($userFailed) {
            throw new UserDeactivatedException($this->config->get('concrete.user.deactivation.message'));
        }
    }