Fix where QueryBuilder

This commit is contained in:
Michael RICOIS 2017-02-09 12:13:25 +01:00
parent 5b0653c733
commit 20a402b3bb

View File

@ -81,15 +81,15 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
->from('sdv1.utilisateurs', 'u')
->join('u', 'sdv1.clients', 'c', 'u.idClient = c.id')
->where("u.login=:login")->setParameter('login', $this->_username)
->where("u.actif=1")
->where("u.deleted=0")
->where("c.actif='Oui'");
->andWhere("u.actif=1")
->andWhere("u.deleted=0")
->andWhere("c.actif='Oui'");
if (count($this->clients) > 0) {
$qb->where('u.idClient IN('.join(',', $this->clients).')');
$qb->andWhere('u.idClient IN('.join(',', $this->clients).')');
}
if ($this->checkWs) {
$qb->where('u.accesWS=1');
$qb->andWhere('u.accesWS=1');
}
$stmt = $qb->execute();
@ -99,8 +99,6 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
}
}
$result = $userM->fetchRow($sql);
$identity = new stdClass();
$identity->username = $this->_username;
$identity->hash = $this->_hash;
@ -109,6 +107,7 @@ class Scores_Auth_Adapter_Db implements Zend_Auth_Adapter_Interface
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $identity,
array("Identifiant ou mot de passe invalid"));
} else {
$result = $stmt->fetch(PDO::FETC_OBJ);
if ($this->_password == $result->password
|| $this->_password == md5($result->login.'|'.$result->password)) {