Mise à jour de l'authentification

This commit is contained in:
Michael RICOIS 2015-08-31 12:18:19 +00:00
parent 3c5952ba55
commit 2e6000dfe2
3 changed files with 26 additions and 7 deletions

View File

@ -94,6 +94,7 @@ class AuthController extends Zend_Controller_Action
$parameters = new stdClass();
$parameters->login = $login;
$parameters->ipUtilisateur = $adressIp;
$parameters->from = 'auth';
try {
$ws = new Scores_Ws_Client('gestion', '0.3');
$InfosLogin = $ws->getInfosLogin($parameters);

View File

@ -112,8 +112,13 @@ class UserController extends Zend_Controller_Action
}
// --- Mise à jour du profil
if ($isProfilUpdated && $updateResult) {
$ws = new WsScores();
$InfosLogin = $ws->getInfosLogin($identity->username, $_SERVER['REMOTE_ADDR']);
$ws = new Scores_Ws_Client('gestion', '0.3');
$adressIp = $_SERVER['REMOTE_ADDR'];
$parameters = new stdClass();
$parameters->login = $identity->username;
$parameters->ipUtilisateur = $adressIp;
$parameters->from = null;
$InfosLogin = $ws->getInfosLogin($parameters);
$identity = $user->updateProfil($InfosLogin);
$auth->getStorage()->write($identity);
}
@ -121,10 +126,8 @@ class UserController extends Zend_Controller_Action
if ($action=='update') {
$modeEdition = $request->getParam('modeEdition', false);
if ( $modeEdition ) {
$identity->modeEdition = true;
$auth->getStorage()->write($identity);
}
}
}
@ -170,9 +173,13 @@ class UserController extends Zend_Controller_Action
elseif (!empty($op) || $op!='new')
{
if ( !empty($login) && $identity->username != $login ) {
Zend_Registry::get('firebug')->info('getInfosLogin');
$ws = new WsScores();
$reponse = $ws->getInfosLogin($login, $_SERVER['REMOTE_ADDR']);
$ws = new Scores_Ws_Client('gestion', '0.3');
$adressIp = $_SERVER['REMOTE_ADDR'];
$parameters = new stdClass();
$parameters->login = $login;
$parameters->ipUtilisateur = $adressIp;
$parameters->from = null;
$reponse = $ws->getInfosLogin($parameters);
$this->view->assign('options', $reponse->result);
$this->view->assign('loginVu', $reponse->result->login);
$this->view->assign('droits', explode(' ', strtolower($reponse->result->droits)));

View File

@ -78,6 +78,17 @@ class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
require_once 'Scores/WsScores.php';
$ws = new WsScores($this->_username, $this->_password);
$InfosLogin = $ws->getInfosLogin($this->_username, $ip, 'auth');
$ws = new Scores_Ws_Client('gestion', '0.3');
$ws->setHttpLogin($this->_username);
$ws->setHttpPassword($this->_password);
$adressIp = $_SERVER['REMOTE_ADDR'];
$parameters = new stdClass();
$parameters->login = $this->_username;
$parameters->ipUtilisateur = $ip;
$parameters->from = 'auth';
$InfosLogin = $ws->getInfosLogin($parameters);
// --- Renvoi
if ( is_string($InfosLogin) || $InfosLogin->error->errnum != 0 ) {
$message = $InfosLogin;