Mise à jour pour les connexions en IP

This commit is contained in:
Michael RICOIS 2015-07-04 15:06:35 +00:00
parent 02cf20aa85
commit e2d59d385a
2 changed files with 16 additions and 12 deletions

View File

@ -32,7 +32,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
//Est ce que l'on a checkIp=only lors de la requête
$iponly = false;
if ($checkIp=='only') {
if ($checkIp == 'only') {
$hach = 'iponly:'.$_SERVER['REMOTE_ADDR'];
$iponly = true;
}
@ -72,21 +72,21 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
// --- Sinon on reste sur le standard
} else {
// --- Authentifié
if ( $auth->hasIdentity() ) {
// --- Mise à jour du délai de connexion
if ( time() < $auth->getIdentity()->time ) {
$identity = $auth->getIdentity();
$identity->time = time() + $identity->timeout;
$auth->getStorage()->write($identity);
if (Zend_Session::namespaceIsset('login')){
Zend_Session::namespaceUnset('login');
}
// --- Check CGU
if ( $request->getControllerName()!='aide' && $request->getActionName()!='cgu'
|| $request->getControllerName()!='user' && $request->getActionName()!='logout') {
@ -96,19 +96,19 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
->setActionName('cgu');
}
}
// --- Temps de connexion dépassé
} elseif ( time() > $auth->getIdentity()->time ) {
$auth->clearIdentity();
$storage = $auth->getStorage();
Zend_Session::namespaceUnset($storage->getNamespace());
if ( !$request->isXmlHttpRequest() ) {
$session = new Zend_Session_Namespace('login');
$session->url = $_SERVER['REQUEST_URI'];
}
if ( $request->getControllerName()=='index' && $request->getActionName()=='index' ) {
$request->setModuleName('default')
->setControllerName('user')
@ -120,7 +120,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
->setParam('ajax', $request->isXmlHttpRequest());
}
}
}
// --- Pas Authentifié
else {

View File

@ -74,7 +74,11 @@ class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
} elseif ( $InfosLogin !== false && !empty($InfosLogin->result->login)) {
$identity = new stdClass();
$identity->username = $InfosLogin->result->login;
$identity->password = md5($InfosLogin->result->login.'|'.$this->_password);
if ($this->_checkIp) {
$identity->password = $this->_password;
} else {
$identity->password = md5($InfosLogin->result->login.'|'.$this->_password);
}
$identity->email = $InfosLogin->result->email;
$identity->profil = $InfosLogin->result->profil;
$identity->pref = $InfosLogin->result->pref;