Merge branch 'develop' of gitlab.factory.insight.doubletrade.com:scores/extranet into bilanconfidentiel
This commit is contained in:
commit
442ded2379
@ -81,7 +81,7 @@ class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
|
|||||||
public function authenticate()
|
public function authenticate()
|
||||||
{
|
{
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && in_array($ip, $this->listProxyIp)) {
|
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && in_array($ip, $this->listProxyIp)) {
|
||||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,21 +97,25 @@ class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
|
|||||||
|
|
||||||
$this->logger->info(__CLASS__ . ' : '.__METHOD__);
|
$this->logger->info(__CLASS__ . ' : '.__METHOD__);
|
||||||
$this->logger->info(print_r($InfosLogin,1));
|
$this->logger->info(print_r($InfosLogin,1));
|
||||||
// --- Renvoi
|
|
||||||
if ( is_string($InfosLogin) || $InfosLogin->error->errnum != 0 ) {
|
$identity = new stdClass();
|
||||||
|
|
||||||
|
// --- Erreur technique
|
||||||
|
if ($InfosLogin === false) {
|
||||||
|
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity, array("Identification impossible"));
|
||||||
|
}
|
||||||
|
// --- Renvoi
|
||||||
|
elseif (is_string($InfosLogin) || $InfosLogin->error->errnum != 0) {
|
||||||
$message = $InfosLogin;
|
$message = $InfosLogin;
|
||||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
|
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
|
||||||
}
|
}
|
||||||
// --- Assignation identity
|
// --- Assignation identity
|
||||||
elseif ( $InfosLogin !== false && !empty($InfosLogin->result->login)) {
|
elseif ($InfosLogin->result->login == $this->_username) {
|
||||||
$identity = new stdClass();
|
|
||||||
if ($this->_checkIp || $this->_checkHach) {
|
if ($this->_checkIp || $this->_checkHach) {
|
||||||
$this->logger->info("IN");
|
|
||||||
$identity->password = $this->_password;
|
$identity->password = $this->_password;
|
||||||
} else {
|
} else {
|
||||||
$identity->password = md5($InfosLogin->result->login.'|'.$this->_password);
|
$identity->password = md5($InfosLogin->result->login.'|'.$this->_password);
|
||||||
}
|
}
|
||||||
$this->logger->info($identity->password);
|
|
||||||
$identity->username = $InfosLogin->result->login;
|
$identity->username = $InfosLogin->result->login;
|
||||||
$identity->email = $InfosLogin->result->email;
|
$identity->email = $InfosLogin->result->email;
|
||||||
$identity->profil = $InfosLogin->result->profil;
|
$identity->profil = $InfosLogin->result->profil;
|
||||||
@ -138,10 +142,12 @@ class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
|
|||||||
$identity->version = $InfosLogin->result->version;
|
$identity->version = $InfosLogin->result->version;
|
||||||
$identity->modeEdition = false;
|
$identity->modeEdition = false;
|
||||||
|
|
||||||
$timeout = (!empty($InfosLogin->result->timeout)) ? $InfosLogin->result->timeout : $this->_timeout;
|
$timeout = (!empty($InfosLogin->result->timeout)) ?
|
||||||
|
$InfosLogin->result->timeout : $this->_timeout;
|
||||||
$identity->timeout = $timeout;
|
$identity->timeout = $timeout;
|
||||||
$identity->time = time() + $timeout;
|
$identity->time = time() + $timeout;
|
||||||
$lang = in_array($InfosLogin->result->lang, array('fr','en')) ? $InfosLogin->result->lang : 'fr';
|
$lang = in_array($InfosLogin->result->lang, array('fr','en')) ?
|
||||||
|
$InfosLogin->result->lang : 'fr';
|
||||||
$identity->lang = $lang;
|
$identity->lang = $lang;
|
||||||
$identity->langtmp = $lang;
|
$identity->langtmp = $lang;
|
||||||
|
|
||||||
@ -170,8 +176,9 @@ class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
|
|||||||
$this->_password = $identity->password;
|
$this->_password = $identity->password;
|
||||||
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
|
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
|
||||||
}
|
}
|
||||||
|
// --- Fallback
|
||||||
else {
|
else {
|
||||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity, array("Identification impossible"));
|
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity, array("Identification impossible"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user