MOBILE-3523 login: Fix consecutive logins if logout+SSO
This commit is contained in:
		
							parent
							
								
									94b215816e
								
							
						
					
					
						commit
						0f968c6986
					
				| @ -46,6 +46,7 @@ export class CoreMainMenuPage implements OnDestroy { | |||||||
|     protected urlToOpen: string; |     protected urlToOpen: string; | ||||||
|     protected mainMenuId: number; |     protected mainMenuId: number; | ||||||
|     protected keyboardObserver: any; |     protected keyboardObserver: any; | ||||||
|  |     protected resizeFunction; | ||||||
| 
 | 
 | ||||||
|     @ViewChild('mainTabs') mainTabs: CoreIonTabsComponent; |     @ViewChild('mainTabs') mainTabs: CoreIonTabsComponent; | ||||||
| 
 | 
 | ||||||
| @ -115,7 +116,8 @@ export class CoreMainMenuPage implements OnDestroy { | |||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         window.addEventListener('resize', this.initHandlers.bind(this)); |         this.resizeFunction = this.initHandlers.bind(this); | ||||||
|  |         window.addEventListener('resize', this.resizeFunction); | ||||||
| 
 | 
 | ||||||
|         if (CoreApp.instance.isIOS()) { |         if (CoreApp.instance.isIOS()) { | ||||||
|             // In iOS, the resize event is triggered before the keyboard is opened/closed and not triggered again once done.
 |             // 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 { | |||||||
|     ngOnDestroy(): void { |     ngOnDestroy(): void { | ||||||
|         this.subscription && this.subscription.unsubscribe(); |         this.subscription && this.subscription.unsubscribe(); | ||||||
|         this.redirectObs && this.redirectObs.off(); |         this.redirectObs && this.redirectObs.off(); | ||||||
|         window.removeEventListener('resize', this.initHandlers.bind(this)); |         window.removeEventListener('resize', this.resizeFunction); | ||||||
|         CoreApp.instance.setMainMenuOpen(this.mainMenuId, false); |         CoreApp.instance.setMainMenuOpen(this.mainMenuId, false); | ||||||
|         this.keyboardObserver && this.keyboardObserver.off(); |         this.keyboardObserver && this.keyboardObserver.off(); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -1549,11 +1549,16 @@ export class CoreSitesProvider { | |||||||
|         await this.dbReady; |         await this.dbReady; | ||||||
| 
 | 
 | ||||||
|         const site = await this.getSite(siteId); |         const site = await this.getSite(siteId); | ||||||
|         const newValues = { |         const newValues: any = { | ||||||
|             token: '', // Erase the token for security.
 |  | ||||||
|             loggedOut: loggedOut ? 1 : 0 |             loggedOut: loggedOut ? 1 : 0 | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|  |         if (loggedOut) { | ||||||
|  |             // Erase the token for security.
 | ||||||
|  |             newValues.token = ''; | ||||||
|  |             site.token = ''; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         site.setLoggedOut(loggedOut); |         site.setLoggedOut(loggedOut); | ||||||
| 
 | 
 | ||||||
|         return this.appDB.updateRecords(CoreSitesProvider.SITES_TABLE, newValues, { id: siteId }); |         return this.appDB.updateRecords(CoreSitesProvider.SITES_TABLE, newValues, { id: siteId }); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user