Airship\Engine\Security\AirBrake::registerLoginFailure PHP Method

registerLoginFailure() public method

Register a failed login attempt
public registerLoginFailure ( string $username, string $ip, integer $numFailures, HiddenString $password = null ) : boolean
$username string
$ip string
$numFailures integer
$password HiddenString
return boolean
    public function registerLoginFailure(string $username, string $ip, int $numFailures = 0, HiddenString $password = null) : bool
    {
        $logAfter = $this->config['log-after'] ?? null;
        if (!\is_null($logAfter)) {
            $logAfter = (int) $logAfter;
        }
        $publicKey = (string) ($this->config['log-public-key'] ?? '');
        $this->db->beginTransaction();
        $inserts = ['action' => self::ACTION_LOGIN, 'occurred' => (new \DateTime())->format(\AIRSHIP_DATE_FORMAT), 'username' => $username, 'ipaddress' => $ip, 'subnet' => $this->getSubnet($ip)];
        if (\is_int($logAfter) && !empty($publicKey)) {
            if ($numFailures >= $logAfter) {
                // Encrypt the password guess with the admin's public key
                $inserts['sealed_password'] = Asymmetric::seal($password->getString(), $this->getLogPublicKey($publicKey));
            }
        }
        $this->db->insert('airship_failed_logins', $inserts);
        return $this->db->commit();
    }