CS
This commit is contained in:
parent
cac6a65eef
commit
a9ede731f5
@ -47,19 +47,15 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
|||||||
|
|
||||||
// --- On vérifie le tout lors d'une connexion par url
|
// --- On vérifie le tout lors d'une connexion par url
|
||||||
if ( !empty($login) && !empty($pass) ) {
|
if ( !empty($login) && !empty($pass) ) {
|
||||||
|
|
||||||
$authAdapter = new Scores_Auth_Adapter_Db($login, $pass, $checkWs);
|
$authAdapter = new Scores_Auth_Adapter_Db($login, $pass, $checkWs);
|
||||||
$result = $auth->authenticate($authAdapter);
|
$result = $auth->authenticate($authAdapter);
|
||||||
|
|
||||||
if ($result->isValid()) {
|
if ($result->isValid()) {
|
||||||
|
|
||||||
$storage = new Zend_Auth_Storage_Session();
|
$storage = new Zend_Auth_Storage_Session();
|
||||||
$session = new Zend_Session_Namespace($storage->getNamespace());
|
$session = new Zend_Session_Namespace($storage->getNamespace());
|
||||||
//$session->setExpirationSeconds(86400);
|
//$session->setExpirationSeconds(86400);
|
||||||
$auth->setStorage($storage);
|
$auth->setStorage($storage);
|
||||||
|
}
|
||||||
} else {
|
else {
|
||||||
|
|
||||||
$layout = Zend_Layout::getMVCInstance();
|
$layout = Zend_Layout::getMVCInstance();
|
||||||
if ( !$layout->isEnabled() ){
|
if ( !$layout->isEnabled() ){
|
||||||
echo "Identification incorrect ou périmé.";
|
echo "Identification incorrect ou périmé.";
|
||||||
@ -68,29 +64,24 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
|||||||
->setControllerName('user')
|
->setControllerName('user')
|
||||||
->setActionName('logout');
|
->setActionName('logout');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Sinon on reste sur le standard
|
// Sinon on reste sur le standard
|
||||||
} else {
|
else {
|
||||||
|
// Pas authentifié
|
||||||
//Pas authentifié
|
|
||||||
if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) {
|
if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) {
|
||||||
|
|
||||||
$layout = Zend_Layout::getMVCInstance();
|
$layout = Zend_Layout::getMVCInstance();
|
||||||
if (!$layout->isEnabled()){
|
if (!$layout->isEnabled()){
|
||||||
echo "Identification incorrect ou périmé.";
|
echo "Identification incorrect ou périmé.";
|
||||||
} else {
|
} else {
|
||||||
$this->_response->setRedirect('/user/login')->sendResponse();
|
$this->_response->setRedirect('/user/login')->sendResponse();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Authentifié => on met à jour la session
|
// Authentifié => on met à jour la session
|
||||||
} else {
|
else {
|
||||||
|
|
||||||
$identity = $auth->getIdentity();
|
$identity = $auth->getIdentity();
|
||||||
$identity->time = time() + $identity->timeout;
|
$identity->time = time() + $identity->timeout;
|
||||||
$auth->getStorage()->write($identity);
|
$auth->getStorage()->write($identity);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user