Commit 07f44c2f authored by Florian Azizian's avatar Florian Azizian
Browse files

FIX #17253 TIME 0:10 History for userlogin and userlogout

parent 2ab6303f
......@@ -64,7 +64,7 @@ if ($notification['is_enabled'] === 'N') {
//SECOND STEP
writeLog(['message' => "Loading events for notification {$notificationId}", 'level' => 'INFO']);
$events = \Notification\models\NotificationsEventsModel::get(['select' => ['*'], 'where' => ['notification_sid = ?', 'exec_date is NULL'], 'data' => [$notification['notification_sid']]]);
$events = \Notification\models\NotificationsEventsModel::get(['select' => ['*'], 'where' => ['notification_sid = ?', 'exec_date is NULL'], 'data' => [$notification['notification_sid']], 'orderBy' => ['event_date desc']]);
$totalEventsToProcess = count($events);
$currentEvent = 0;
if ($totalEventsToProcess === 0) {
......
......@@ -373,7 +373,7 @@ class AuthenticationController
'eventType' => 'LOGIN',
'info' => _LOGIN . ' : ' . $login,
'moduleId' => 'authentication',
'eventId' => 'login'
'eventId' => 'userlogin'
]);
return $response->withStatus(204);
......@@ -395,6 +395,15 @@ class AuthenticationController
$logoutUrl = $disconnection['logoutUrl'];
}
HistoryController::add([
'tableName' => 'users',
'recordId' => $GLOBALS['id'],
'eventType' => 'LOGOUT',
'info' => _LOGOUT . ' : ' . $GLOBALS['login'],
'moduleId' => 'authentication',
'eventId' => 'userlogout'
]);
return $response->withJson(['logoutUrl' => $logoutUrl]);
}
......
......@@ -160,6 +160,7 @@ define('_DOCUMENT_UNSIGNED', 'Document unsigned');
define('_LINK_ADDED_TAG', 'Tag link added');
define('_LINK_DELETED_TAG', 'Tag link deleted');
define('_LOGIN', 'User connection');
define('_LOGOUT', 'User disconnection');
// ADMINISTRATION
define('_USERS', 'Users');
......
......@@ -160,6 +160,7 @@ define('_DOCUMENT_UNSIGNED', 'Document dé-signé');
define('_LINK_ADDED_TAG', 'Liaison de mot-clé ajoutée');
define('_LINK_DELETED_TAG', 'Liaison de mot-clé supprimée');
define('_LOGIN', 'Connexion de l\'utilisateur');
define('_LOGOUT', 'Déconnexion de l\'utilisateur');
// ADMINISTRATION
define('_USERS', 'Utilisateurs');
......
......@@ -59,7 +59,7 @@
</a>
</div>
<div *ngIf="showLogout()" style="text-align:right;flex:2;">
<a (click)="authService.logout()" style="cursor:pointer; color: white;padding-right: 10px;">
<a (click)="authService.logout(true, false, true)" style="cursor:pointer; color: white;padding-right: 10px;">
<span class="badge action-header-profile">{{'lang.logout' | translate}}</span>
</a>
</div>
......
......@@ -125,11 +125,14 @@ export class AuthService {
);
}
async logout(cleanUrl: boolean = true, forcePageLogin: boolean = false) {
async logout(cleanUrl: boolean = true, forcePageLogin: boolean = false, history: boolean = false) {
this.clearFilters();
if (['cas', 'keycloak'].indexOf(this.authMode) > -1 && !forcePageLogin) {
this.SsoLogout(cleanUrl);
} else {
if (history) {
this.http.get('../rest/authenticate/logout').subscribe();
}
// HANDLE LOGOUT IN GUARD FOR PROCESS
if (['process'].indexOf(this.router.url.split('/')[1]) > -1) {
this.router.navigate(['/login']);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment