MOBILE-2996 login: Prevent overriding user if sso+logout
parent
b73b3d2727
commit
1b8b142646
|
@ -442,22 +442,8 @@ export class CoreLoginHelperProvider {
|
||||||
* @return {Promise<any>} Promise resolved when the user is authenticated with the token.
|
* @return {Promise<any>} Promise resolved when the user is authenticated with the token.
|
||||||
*/
|
*/
|
||||||
handleSSOLoginAuthentication(siteUrl: string, token: string, privateToken?: string): Promise<any> {
|
handleSSOLoginAuthentication(siteUrl: string, token: string, privateToken?: string): Promise<any> {
|
||||||
if (this.sitesProvider.isLoggedIn()) {
|
// Always create a new site to prevent overriding data if another user credentials were introduced.
|
||||||
// User logged in, he is reconnecting. Retrieve username.
|
return this.sitesProvider.newSite(siteUrl, token, privateToken);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue