MOBILE-3320 login: Fix application check
parent
d9b55440df
commit
a16c3d3ce6
|
@ -348,7 +348,8 @@ export class CoreLoginSitePage implements OnInit {
|
|||
* @return Promise resolved after logging in.
|
||||
*/
|
||||
protected async login(response: CoreSiteCheckResponse, foundSite?: CoreLoginSiteInfoExtended): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(CoreSites.checkApplication(response));
|
||||
try {
|
||||
await CoreSites.checkApplication(response);
|
||||
|
||||
CoreForms.triggerFormSubmittedEvent(this.formElement, true);
|
||||
|
||||
|
@ -375,6 +376,9 @@ export class CoreLoginSitePage implements OnInit {
|
|||
params: pageParams,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
// Ignore errors.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1174,13 +1174,15 @@ export class CoreSitesProvider {
|
|||
* @return Promise resolved when the user is logged out.
|
||||
*/
|
||||
async logout(): Promise<void> {
|
||||
let siteId: string | undefined;
|
||||
const promises: Promise<unknown>[] = [];
|
||||
if (!this.currentSite) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.currentSite) {
|
||||
const db = await this.appDB;
|
||||
|
||||
const promises: Promise<unknown>[] = [];
|
||||
const siteConfig = this.currentSite.getStoredConfig();
|
||||
siteId = this.currentSite.getId();
|
||||
const siteId = this.currentSite.getId();
|
||||
|
||||
this.currentSite = undefined;
|
||||
|
||||
|
@ -1189,14 +1191,11 @@ export class CoreSitesProvider {
|
|||
}
|
||||
|
||||
promises.push(db.deleteRecords(CURRENT_SITE_TABLE_NAME, { id: 1 }));
|
||||
}
|
||||
|
||||
try {
|
||||
await Promise.all(promises);
|
||||
} finally {
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
|
||||
CoreEvents.trigger(CoreEvents.LOGOUT, {}, siteId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the session to the previous one so the user doesn't has to login everytime the app is started.
|
||||
|
|
Loading…
Reference in New Issue