MOBILE-3965 login: Always force logout when click 'Logout' button

main
Dani Palou 2022-02-01 10:43:23 +01:00
parent 85eaeb44fe
commit 5ec817e7f5
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;
} }