Merge pull request #2061 from dpalou/MOBILE-3106
MOBILE-3106 login: Check redirect if get site info failsmain
commit
3da5e07f1a
|
@ -1454,7 +1454,15 @@ export class CoreSite {
|
|||
preSets.noLogin = true;
|
||||
preSets.useGet = true;
|
||||
|
||||
return this.wsProvider.callAjax('tool_mobile_get_public_config', {}, preSets);
|
||||
return this.wsProvider.callAjax('tool_mobile_get_public_config', {}, preSets).catch((error2) => {
|
||||
if (this.getInfo() && this.isVersionGreaterEqualThan('3.8')) {
|
||||
// GET is supported, return the second error.
|
||||
return Promise.reject(error2);
|
||||
} else {
|
||||
// GET not supported or we don't know if it's supported. Return first error.
|
||||
return Promise.reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
|
|
|
@ -470,6 +470,20 @@ export class CoreSitesProvider {
|
|||
// Service supported but an error happened. Return error.
|
||||
error.critical = true;
|
||||
|
||||
if (error.errorcode == 'codingerror') {
|
||||
// This could be caused by a redirect. Check if it's the case.
|
||||
return this.utils.checkRedirect(siteUrl).then((redirect) => {
|
||||
if (redirect) {
|
||||
error.error = this.translate.instant('core.login.sitehasredirect');
|
||||
} else {
|
||||
// We can't be sure if there is a redirect or not. Display cannot connect error.
|
||||
error.error = this.translate.instant('core.cannotconnect');
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue