Skip to content

Commit 0f968c6

Browse files
committed
MOBILE-3523 login: Fix consecutive logins if logout+SSO
1 parent 94b2158 commit 0f968c6

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/core/mainmenu/pages/menu/menu.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class CoreMainMenuPage implements OnDestroy {
4646
protected urlToOpen: string;
4747
protected mainMenuId: number;
4848
protected keyboardObserver: any;
49+
protected resizeFunction;
4950

5051
@ViewChild('mainTabs') mainTabs: CoreIonTabsComponent;
5152

@@ -115,7 +116,8 @@ export class CoreMainMenuPage implements OnDestroy {
115116
}
116117
});
117118

118-
window.addEventListener('resize', this.initHandlers.bind(this));
119+
this.resizeFunction = this.initHandlers.bind(this);
120+
window.addEventListener('resize', this.resizeFunction);
119121

120122
if (CoreApp.instance.isIOS()) {
121123
// In iOS, the resize event is triggered before the keyboard is opened/closed and not triggered again once done.
@@ -241,7 +243,7 @@ export class CoreMainMenuPage implements OnDestroy {
241243
ngOnDestroy(): void {
242244
this.subscription && this.subscription.unsubscribe();
243245
this.redirectObs && this.redirectObs.off();
244-
window.removeEventListener('resize', this.initHandlers.bind(this));
246+
window.removeEventListener('resize', this.resizeFunction);
245247
CoreApp.instance.setMainMenuOpen(this.mainMenuId, false);
246248
this.keyboardObserver && this.keyboardObserver.off();
247249
}

src/providers/sites.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,11 +1549,16 @@ export class CoreSitesProvider {
15491549
await this.dbReady;
15501550

15511551
const site = await this.getSite(siteId);
1552-
const newValues = {
1553-
token: '', // Erase the token for security.
1552+
const newValues: any = {
15541553
loggedOut: loggedOut ? 1 : 0
15551554
};
15561555

1556+
if (loggedOut) {
1557+
// Erase the token for security.
1558+
newValues.token = '';
1559+
site.token = '';
1560+
}
1561+
15571562
site.setLoggedOut(loggedOut);
15581563

15591564
return this.appDB.updateRecords(CoreSitesProvider.SITES_TABLE, newValues, { id: siteId });

0 commit comments

Comments
 (0)