public function findWithCredentials($email, $password, $ip) { //TROP DE CONNEXION FAILLED $userSession = new UserSession(); $userSession->tryConnection($ip); //EXCEPTION INSIDE $Database = new Database(); $user = $Database->queryOne('SELECT Id, Password FROM Customer WHERE Email = ?', [$email]); if (!$user) { $userSession->createLoginByIp($ip); throw new DomainException('Email inconnu'); } else { $verificationPassword = $this->verifyPassword($password, $user['Password']); if ($verificationPassword) { $this->updateLastLoginTimestamp($user['Id']); $userSession->createLoginByIp($ip, $user['Id'], 1); return $user['Id']; } else { $userSession->createLoginByIp($ip); throw new DomainException('Mauvaise Mots de Passe'); } } }