mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
logout wait
This commit is contained in:
@@ -130,7 +130,10 @@ class AppService
|
||||
$this->config->get('auth2FAForced') &&
|
||||
!$user->get('auth2FA');
|
||||
|
||||
$passwordChangeForNonAdminDisabled = $this->authenticationMethodProvider->get() !== Espo::NAME;
|
||||
$authenticationMethod = $this->authenticationMethodProvider->get();
|
||||
|
||||
$passwordChangeForNonAdminDisabled = $authenticationMethod !== Espo::NAME;
|
||||
$logoutWait = (bool) $this->metadata->get(['authenticationMethods', $authenticationMethod, 'logoutClassName']);
|
||||
|
||||
$timeZoneList = $this->metadata
|
||||
->get(['entityDefs', Settings::ENTITY_TYPE, 'fields', 'timeZone', 'options']) ?? [];
|
||||
@@ -141,6 +144,7 @@ class AppService
|
||||
'passwordChangeForNonAdminDisabled' => $passwordChangeForNonAdminDisabled,
|
||||
'timeZoneList' => $timeZoneList,
|
||||
'auth2FARequired' => $auth2FARequired,
|
||||
'logoutWait' => $logoutWait,
|
||||
];
|
||||
|
||||
/** @var array<string, array<string, mixed>> $map */
|
||||
|
||||
1
client/res/templates/logout-wait.tpl
Normal file
1
client/res/templates/logout-wait.tpl
Normal file
@@ -0,0 +1 @@
|
||||
<div></div>
|
||||
@@ -938,17 +938,25 @@ function (
|
||||
* @private
|
||||
*/
|
||||
logout: function (afterFail, silent) {
|
||||
let logoutWait = false;
|
||||
|
||||
if (this.auth && !afterFail) {
|
||||
let arr = Base64.decode(this.auth).split(':');
|
||||
|
||||
if (arr.length > 1) {
|
||||
logoutWait = this.appParams.logoutWait || false;
|
||||
|
||||
Ajax.postRequest('App/action/destroyAuthToken', {token: arr[1]}, {fullResponse: true})
|
||||
.then(xhr => {
|
||||
let redirectUrl = xhr.getResponseHeader('X-Logout-Redirect-Url');
|
||||
|
||||
if (redirectUrl) {
|
||||
setTimeout(() => window.location.href = redirectUrl, 50);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.doAction({action: 'login'});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -973,7 +981,9 @@ function (
|
||||
this.storage.clear('user', 'anotherUser');
|
||||
}
|
||||
|
||||
this.doAction({action: 'login'});
|
||||
let action = logoutWait ? 'logoutWait' : 'login';
|
||||
|
||||
this.doAction({action: action});
|
||||
|
||||
if (!silent) {
|
||||
this.unsetCookieAuth();
|
||||
|
||||
@@ -133,6 +133,13 @@ define('controllers/base', ['controller'], function (Dep) {
|
||||
this.logout();
|
||||
},
|
||||
|
||||
actionLogoutWait: function () {
|
||||
this.entire('views/base', {template: 'logout-wait'}, view => {
|
||||
view.render()
|
||||
.then(() => Espo.Ui.notify(' ... '))
|
||||
});
|
||||
},
|
||||
|
||||
actionClearCache: function () {
|
||||
this.clearCache();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user