Merge pull request #3085 from dpalou/MOBILE-3965

MOBILE-3965 login: Always force logout when click 'Logout' button
main
Pau Ferrer Ocaña 2022-02-02 11:59:22 +01:00 committed by GitHub
commit 9f63d7307c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -169,7 +169,7 @@ export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy {
async logout(event: Event): Promise<void> { async logout(event: Event): Promise<void> {
await this.close(event); await this.close(event);
CoreSites.logout(); CoreSites.logout(true);
} }
/** /**

View File

@ -1181,9 +1181,10 @@ export class CoreSitesProvider {
/** /**
* Logout the user. * Logout the user.
* *
* @param forceLogout If true, site will be marked as logged out, no matter the value tool_mobile_forcelogout.
* @return Promise resolved when the user is logged out. * @return Promise resolved when the user is logged out.
*/ */
async logout(): Promise<void> { async logout(forceLogout = false): Promise<void> {
if (!this.currentSite) { if (!this.currentSite) {
return; return;
} }
@ -1194,7 +1195,7 @@ export class CoreSitesProvider {
this.currentSite = undefined; this.currentSite = undefined;
if (siteConfig && siteConfig.tool_mobile_forcelogout == '1') { if (forceLogout || (siteConfig && siteConfig.tool_mobile_forcelogout == '1')) {
promises.push(this.setSiteLoggedOut(siteId)); promises.push(this.setSiteLoggedOut(siteId));
} }
@ -1222,7 +1223,7 @@ export class CoreSitesProvider {
CoreApp.storeRedirect(siteId, redirectData); CoreApp.storeRedirect(siteId, redirectData);
} }
await CoreSites.logout(); await this.logout();
return CoreSitePlugins.hasSitePluginsLoaded; return CoreSitePlugins.hasSitePluginsLoaded;
} }