mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
EventService: refactoring
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
use Combodo\iTop\Application\Branding;
|
||||
use Combodo\iTop\Application\Helper\Session;
|
||||
use Combodo\iTop\Service\EventData;
|
||||
use Combodo\iTop\Service\EventName;
|
||||
use Combodo\iTop\Service\EventService;
|
||||
|
||||
/**
|
||||
@@ -446,7 +445,6 @@ class LoginWebPage extends NiceWebPage
|
||||
Session::Set('login_state', self::LOGIN_STATE_START);
|
||||
}
|
||||
$sLoginState = Session::Get('login_state');
|
||||
$bFireEvent = ($sLoginState != self::LOGIN_STATE_CONNECTED);
|
||||
|
||||
$sSessionLog = '';
|
||||
if ($bLoginDebug)
|
||||
@@ -487,16 +485,13 @@ class LoginWebPage extends NiceWebPage
|
||||
$iResponse = $oLoginFSMExtensionInstance->LoginAction($sLoginState, $iErrorCode);
|
||||
if ($iResponse == self::LOGIN_FSM_RETURN)
|
||||
{
|
||||
if ($bFireEvent)
|
||||
{
|
||||
EventService::FireEvent(new EventData(EventName::LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
|
||||
}
|
||||
EventService::FireEvent(new EventData(EVENT_SERVICE_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
|
||||
Session::WriteClose();
|
||||
return $iErrorCode; // Asked to exit FSM, generally login OK
|
||||
}
|
||||
if ($iResponse == self::LOGIN_FSM_ERROR)
|
||||
{
|
||||
EventService::FireEvent(new EventData(EventName::LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
|
||||
EventService::FireEvent(new EventData(EVENT_SERVICE_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
|
||||
$sLoginState = self::LOGIN_STATE_SET_ERROR; // Next state will be error
|
||||
// An error was detected, skip the other plugins turn
|
||||
break;
|
||||
@@ -510,7 +505,7 @@ class LoginWebPage extends NiceWebPage
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
EventService::FireEvent(new EventData(EventName::LOGIN, null, ['state' => $_SESSION['login_state']]));
|
||||
EventService::FireEvent(new EventData(EVENT_SERVICE_LOGIN, null, ['state' => $_SESSION['login_state']]));
|
||||
IssueLog::Error($e->getTraceAsString());
|
||||
static::ResetSession();
|
||||
die($e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user