Amélioration connexion IP Only avec ajout de debug

This commit is contained in:
Michael RICOIS 2016-09-14 13:33:37 +02:00
parent ebde33371c
commit 9da9eb6c43
5 changed files with 49 additions and 16 deletions

View File

@ -467,9 +467,9 @@ class UserController extends Zend_Controller_Action
}
}
if (!empty($url) && $url!='/user/login' && $url!='/user/logout' && $url!='/localauth'){
$this->_redirect($url);
$this->redirect($url);
}
$this->_redirect('/');
$this->redirect('/');
}
//Auth error
else {
@ -481,6 +481,10 @@ class UserController extends Zend_Controller_Action
}
}
}
// Pas de validation du formulaire
else {
Zend_Registry::get('firebug')->info('DISPLAY');
}
}
/**
@ -515,6 +519,17 @@ class UserController extends Zend_Controller_Action
}
}
/**
* Erreur pour les connexions en ipOnly
*/
public function iponlyAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$message = $request->getParam('message');
$this->view->assign('message', $message);
}
/**
* Mettre à jour le mode edition en session sans refresh de la page
*/

View File

@ -0,0 +1 @@
Scores & Decisions : <?=$this->message?>

View File

@ -5,25 +5,33 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
{
Zend_Registry::get('firebug')->info('PLUGIN AUTH - START');
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$checkAuth = true;
if ($request->getControllerName()=='user' && $request->getActionName()=='login') {
if ($controller == 'user' && $action == 'login') {
$checkAuth = false;
}
if ($request->getControllerName()=='user' && $request->getActionName()=='motpasse') {
if ($controller == 'user' && $action == 'motpasse') {
$checkAuth = false;
}
if ($request->getControllerName()=='auth') {
if ($controller == 'auth') {
$checkAuth = false;
}
if ($request->getModuleName()=='file' && $request->getClientIp(false)=='78.31.45.206') {
if ($module == 'file' && $request->getClientIp(false) == '78.31.45.206') {
$checkAuth = false;
}
$checkIp = $request->getParam('checkIp');
if ($checkIp !== null) {
$checkAuth = true;
}
if ($checkAuth) {
$login = $request->getParam('login');
$pass = $request->getParam('pass', '');
$hach = $request->getParam('hach');
@ -41,6 +49,8 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
// --- On vérifie le tout lors d'une connexion par url
if ( !empty($login) && !empty($hach) ) {
Zend_Registry::get('firebug')->info('AUTH : IPONLY');
// --- Mode hach
if ($mode === null) {
$mode = 'hach';
@ -50,7 +60,6 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
$result = $auth->authenticate($authAdapter);
if ( $result->isValid() ) {
// --- Store identity in sesssion
$storage = new Zend_Auth_Storage_Session();
$session = new Zend_Session_Namespace($storage->getNamespace());
@ -64,17 +73,24 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
} else {
//Save botnet information
}
} else {
$messageF = '';
foreach ($result->getMessages() as $message) {
$messageF.= $message."<br/>";
}
if ($mode == 'iponly') {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('iponly')
->setParam('message', $messageF);
}
else {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('logout')
->setParam('message', $messageF);
}
}
// --- Sinon on reste sur le standard
} else {

View File

@ -85,6 +85,8 @@ class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
$parameters->from = 'auth';
$InfosLogin = $ws->getInfosLogin($parameters);
Zend_Registry::get('firebug')->info(__CLASS__ . ' : '.__METHOD__);
Zend_Registry::get('firebug')->info($InfosLogin);
// --- Renvoi
if ( is_string($InfosLogin) || $InfosLogin->error->errnum != 0 ) {
$message = $InfosLogin;
@ -157,8 +159,8 @@ class Scores_Auth_Adapter_Ws implements Zend_Auth_Adapter_Interface
$this->_username = $identity->username;
$this->_password = $identity->password;
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
} else {
}
else {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity, array("Identification impossible"));
}
}

View File

@ -16,7 +16,6 @@ return array(
'getInfosLogin' => array(
'debug' => true,
'errorMsg' => array('ERR'),
'log' => 'mail',
),
'getListeClients' => array(
'log' => 'mail',