2
0
forked from Wavyzz/dolibarr

Add possibility to include login method in a module

This commit is contained in:
Regis Houssin
2010-08-24 12:42:14 +00:00
parent b5333b5567
commit ec1ad78765
3 changed files with 25 additions and 4 deletions

View File

@@ -108,6 +108,10 @@ class InterfaceDemo
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_UPDATE_SESSION')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@@ -125,6 +129,10 @@ class InterfaceDemo
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_LOGOUT')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}

View File

@@ -336,10 +336,7 @@ if (! defined('NOLOGIN'))
if (is_array($conf->login_method_modules) && !empty($conf->login_method_modules))
{
$login = getLoginMethod();
if ($login)
{
$test=false;
}
if ($login) $test=false;
}
// Validation tests user / password
@@ -486,6 +483,15 @@ if (! defined('NOLOGIN'))
header('Location: '.DOL_URL_ROOT.'/index.php');
exit;
}
else
{
// Call triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('USER_UPDATE_SESSION',$user,$user,$langs,$conf,(isset($_POST["entity"])?$_POST["entity"]:0));
if ($result < 0) { $error++; }
// End call triggers
}
}
// Is it a new session ?

View File

@@ -41,6 +41,13 @@ if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuse
die("Disconnection does not work when connection was made in mode ".$_SESSION["dol_authmode"]);
}
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('USER_LOGOUT',$user,$user,$langs,$conf,$conf->entity);
if ($result < 0) { $error++; }
// Fin appel triggers
// Define url to go after disconnect
$urlfrom=empty($_SESSION["urlfrom"])?'':$_SESSION["urlfrom"];