From 1b8b142646e7c26357fec5e62cbf6bcbebb66f3d Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 26 Apr 2019 09:31:12 +0200 Subject: [PATCH] MOBILE-2996 login: Prevent overriding user if sso+logout --- src/core/login/providers/helper.ts | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/core/login/providers/helper.ts b/src/core/login/providers/helper.ts index 21154313c..0083ee413 100644 --- a/src/core/login/providers/helper.ts +++ b/src/core/login/providers/helper.ts @@ -442,22 +442,8 @@ export class CoreLoginHelperProvider { * @return {Promise} Promise resolved when the user is authenticated with the token. */ handleSSOLoginAuthentication(siteUrl: string, token: string, privateToken?: string): Promise { - if (this.sitesProvider.isLoggedIn()) { - // User logged in, he is reconnecting. Retrieve username. - const info = this.sitesProvider.getCurrentSite().getInfo(); - if (typeof info != 'undefined' && typeof info.username != 'undefined') { - return this.sitesProvider.updateSiteToken(info.siteurl, info.username, token, privateToken).then(() => { - return this.sitesProvider.updateSiteInfoByUrl(info.siteurl, info.username); - }, () => { - // Error updating token, return proper error message. - return Promise.reject(this.translate.instant('core.login.errorupdatesite')); - }); - } - - return Promise.reject(this.translate.instant('core.login.errorupdatesite')); - } else { - return this.sitesProvider.newSite(siteUrl, token, privateToken); - } + // Always create a new site to prevent overriding data if another user credentials were introduced. + return this.sitesProvider.newSite(siteUrl, token, privateToken); } /**