Modification enregistrement des options utilisateurs

This commit is contained in:
Michael RICOIS 2012-04-23 14:43:34 +00:00
parent ce12330ce5
commit ada634bdb1
2 changed files with 13 additions and 23 deletions

View File

@ -31,7 +31,7 @@ class UserController extends Zend_Controller_Action
$identity->typeScore = $InfosLogin->result->typeScore;
$identity->timeout = (!empty($InfosLogin->result->timeout)) ?
$InfosLogin->result->timeout : 1800;
$identity->time = time() + $identity->timeout;
$identity->modeEdition = false;
return $identity;
}
@ -129,42 +129,41 @@ class UserController extends Zend_Controller_Action
//Récupération des informations de l'identité
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity(); Zend_Registry::get('firebug')->info($identity);
$identity = $auth->getIdentity();
if ($identity->idClient == $options['idClient'] && $identity->username == $login) {
//Modification lors du changement de mot de passe
if ($options['changepwd']==1 && $updateResult) {
Zend_Registry::get('firebug')->info('CHANGEPWD');
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$identity->password = md5($login.'|'.$options['password']);
$auth->getStorage()->write($identity);
}
//Mise à jour du profil
if ($isProfilUpdated && $updateResult) {
Zend_Registry::get('firebug')->info('MISE A JOUR PROFIL DANS SESSION');
$identity = $this->updateProfil($identity->username, $identity->password);
$auth->getStorage()->write($identity);
}
//Gestion mode edition en SESSION
if ($action=='update') {
$modeEdition = $request->getParam('modeEdition', false);
if ($modeEdition){
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
if ( $modeEdition ) {
$identity->modeEdition = true;
$auth->getStorage()->write($identity);
Zend_Registry::get('firebug')->info('MAJ MODE EDITION SESSION');
}
}
}
if ($isProfilUpdated || $isPasswordUpdated) {
if ( $isProfilUpdated || $isPasswordUpdated ) {
$this->view->assign('message', $message);
}
$isAdmin = false;
if ($identity->profil == 'Administrateur'
|| $identity->profil == 'SuperAdministrateur') {
if ( $identity->profil == 'Administrateur'
|| $identity->profil == 'SuperAdministrateur' ) {
$isAdmin = true;
}
$this->view->assign('isAdmin', $isAdmin);

View File

@ -55,8 +55,6 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
//Sinon on reste sur le standard
} else {
Zend_Registry::get('firebug')->info('TIME : '.date('Y-m-d H:i:s',time()));
//Pas authentifié
if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) {
@ -74,16 +72,9 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
//Authentifié => on met à jour la session
} else {
$identity = $auth->getIdentity();
Zend_Registry::get('firebug')->info('TIMEOUT : '.$identity->timeout);
Zend_Registry::get('firebug')->info('ID TIME : '.date('Y-m-d H:i:s',$identity->time));
$identity = $auth->getIdentity();
$identity->time = time() + $identity->timeout;
$auth->getStorage()->write($identity);
Zend_Registry::get('firebug')->info('UP TIME : '.date('Y-m-d H:i:s',$auth->getIdentity()->time));
if (Zend_Session::namespaceIsset('login')){
Zend_Session::namespaceUnset('login');