Track a login attempt for a user

@param string $username
@param string $password

@return $this
499887
public function trackAttempt($username, $password)
    {
        if (!$this->config->get('concrete.user.deactivation.authentication_failure.enabled', false)) {
            return $this;
        }

        $user = $this->resolveUser($username);
        if (!$user) {
            return;
        }

        $attempt = new LoginAttempt();
        $attempt->setUtcDate(Carbon::now('UTC'));
        $attempt->setUserId($user->getUserID());
        $this->entityManager->persist($attempt);

        // Make sure we get flushed with the next batch
        $this->batch[] = $attempt;

        // Prune old attempts
        $this->pruneAttempts();

        return $this;
    }
739134
public function login($username, $password, $data)
    {
        // Verify the password against the stored hash
        if (!password_verify($password, $this->getStoredPassword($username))) {
            throw new \Exception('Incorrect username or password', 401);
        }

        // Create token
        return $this->app->tokens->create($data);
    }
1181990
public function setProxyAuth($user, $password)
    {
        $this->setProxyUser($user);
        $this->setProxyPassword($password);

        return $this;
    }
56210
public function authenticate($username, $password)
    {
        try {
            $user = $this->userProvider->loadUserByUsername($username);
        } catch (UsernameNotFoundException $e) {
            return null;
        }

        $valid = $this->encoderFactory->getEncoder($user)->isPasswordValid(
            $user->getPassword(),
            $password,
            $user->getSalt()
        );

        if ($valid) {
            return $user;
        }

        return null;
    }
550291
public function setAuthorization($username, $password)
    {
        $this->username = $username;
        $this->password = $password;

        return $this;
    }
291964
protected function forgetMe($username, $password)
    {
        $melisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
        $authCookieConfig = $melisCoreConfig->getItem('meliscore/datas/default/auth_cookies');
        $expire = $authCookieConfig['expire'];


        $user = new SetCookie('cookie1', $this->crypt($username), strtotime($expire, time()));
        $remember = new SetCookie('remember', 0, strtotime($expire, time()));

        $this->getResponse()->getHeaders()->addHeader($user);
        $this->getResponse()->getHeaders()->addHeader($remember);

        // add code here to remove session
        $sessionManager = new SessionManager();
        $sessionManager->forgetMe();
        Container::setDefaultManager($sessionManager);
    }
634913
public function userPwd($username, $password)
    {
        $this->username = $username;
        $this->password = $password;
        return $this;
    }
1043247
public function user_login($username, $password) {
        $cached = $this->get_static_user_info();
        if (empty($cached)) {
            // This means we were called as part of a normal login flow - without using oauth.
            return false;
        }
        $verifyusername = $cached['username'];
        if ($verifyusername == $username) {
            return true;
        }
        return false;
    }
1284262
public function authenticateUser($username, $password)
    {
        try
        {
            return $this->httpHelper->post("customer_portal/auth", ['username' => $username, 'password' => $password]);
        }
        catch (ApiException $e)
        {
            throw new AuthenticationException($e->getMessage());
        }
    }
434049
public function Login ($username = '', $password = '') {
    if ($this->connected == false) {
      $this->error = 'Not connected to POP3 server';

      if ($this->do_debug >= 1) {
        $this->displayErrors();
      }
    }

    if (empty($username)) {
      $username = $this->username;
    }

    if (empty($password)) {
      $password = $this->password;
    }

    $pop_username = "USER $username" . $this->CRLF;
    $pop_password = "PASS $password" . $this->CRLF;

    //  Send the Username
    $this->sendString($pop_username);
    $pop3_response = $this->getResponse();

    if ($this->checkResponse($pop3_response)) {
      //  Send the Password
      $this->sendString($pop_password);
      $pop3_response = $this->getResponse();

      if ($this->checkResponse($pop3_response)) {
        return true;
      } else {
        return false;
      }
    } else {
      return false;
    }
  }
1041525
public function login($username = 'anonymous', $password = '')
    {
        $result = $this->ftp->login($username, $password);

        if ($result === false) {
            throw new FtpException('Login incorrect');
        }

        return $this;
    }
983226
public function userWithPass($username, $password)
    {
        $header = base64_encode(sprintf('%s:%s', $username, $password));

        $this->headers['Authorization'] = 'Basic ' . $header;
    }
934189
public function login($username, $password)
    {
        $args = array($username, $password);
        $token = $this->_soapAdapter->call('login', $args);
        $this->setToken($token);
        return $token;
    }
1160632
public function login($username, $password)
    {
        $user = $this->getUserByField("username", $username);

        if ($password === null) {
            throw new Exception("Empty password field.");
        }

        if ($user->id === null) {
            throw new Exception("Error, not valid credentials.");
        }

        if ($user->deleted !== null) {
            throw new Exception("User deleted.");
        }

        if ((int)$user->enabled === 0) {
            throw new Exception("Error, disabled account.");
        }

        if ($this->validatePassword($password, $user->password)) {
            $this->session->set("user", $user);
            return true;
        }
        throw new Exception("Error, not valid credentials.");
    }
742296
public function login(?string $username, ?string $password)
    {
        try {
            $this->startBrokerSession();

            if (!$username || !$password) {
                $this->fail('No username and/or password provided.');
            }

            if (!$this->authenticate($username, $password)) {
                $this->fail('User authentication failed.');
            }
        } catch (SSOServerException $e) {
            return $this->returnJson(['error' => $e->getMessage()]);
        }

        $this->setSessionData('sso_user', $username);

        return $this->userInfo();
    }
209416
public function amHttpAuthenticated($username, $password)
    {
        if ($this->isFunctional) {
            $this->client->setServerParameter('PHP_AUTH_USER', $username);
            $this->client->setServerParameter('PHP_AUTH_PW', $password);
        } else {
            $this->client->setAuth($username, $password);
        }
    }
1190852
public function authentication($username, $password)
    {
        $endpoint = sprintf('authentication?username=%s', urlencode($username));
        $parameters['value'] = $password;
        return $this->apiClient->callEndpoint(
            $endpoint,
            $parameters,
            null,
            HttpMethod::REQUEST_POST
        );
    }