Merge pull request #1591 from dpalou/MOBILE-2719
MOBILE-2719 login: Don't send fake credentialsmain
commit
9e95285f62
|
@ -378,16 +378,7 @@ export class CoreSitesProvider {
|
||||||
* @return {Promise} A promise to be resolved if the site exists.
|
* @return {Promise} A promise to be resolved if the site exists.
|
||||||
*/
|
*/
|
||||||
siteExists(siteUrl: string): Promise<void> {
|
siteExists(siteUrl: string): Promise<void> {
|
||||||
const data: any = {};
|
return this.http.post(siteUrl + '/login/token.php', {}).timeout(CoreConstants.WS_TIMEOUT).toPromise().catch(() => {
|
||||||
|
|
||||||
if (!this.appProvider.isMobile() && !this.appProvider.isDesktop()) {
|
|
||||||
// Send fake parameters for CORS. This is only needed in browser.
|
|
||||||
data.username = 'a';
|
|
||||||
data.password = 'b';
|
|
||||||
data.service = 'c';
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.http.post(siteUrl + '/login/token.php', data).timeout(CoreConstants.WS_TIMEOUT).toPromise().catch(() => {
|
|
||||||
// Default error messages are kinda bad, return our own message.
|
// Default error messages are kinda bad, return our own message.
|
||||||
return Promise.reject({error: this.translate.instant('core.cannotconnect')});
|
return Promise.reject({error: this.translate.instant('core.cannotconnect')});
|
||||||
}).then((data: any) => {
|
}).then((data: any) => {
|
||||||
|
|
Loading…
Reference in New Issue