forked from EVOgeek/Vmeda.Online
		
	Merge pull request #2350 from dpalou/MOBILE-3384
MOBILE-3384 login: Accept null in local_mobile check response
This commit is contained in:
		
						commit
						0b81dd4c5d
					
				| @ -1376,6 +1376,11 @@ export class CoreSite { | ||||
|             return { code: 0 }; | ||||
|         } | ||||
| 
 | ||||
|         if (data === null) { | ||||
|             // This probably means that the server was configured to return null for non-existing URLs. Not installed.
 | ||||
|             return { code: 0 }; | ||||
|         } | ||||
| 
 | ||||
|         if (typeof data != 'undefined' && data.errorcode === 'requirecorrectaccess') { | ||||
|             if (!retrying) { | ||||
|                 this.siteUrl = this.urlUtils.addOrRemoveWWW(this.siteUrl); | ||||
|  | ||||
| @ -165,7 +165,14 @@ export class CoreLoginSitePage { | ||||
|                     // Attempt guessing the domain if the initial check failed
 | ||||
|                     const domain = CoreUrl.guessMoodleDomain(url); | ||||
| 
 | ||||
|                     return domain ? this.sitesProvider.checkSite(domain) : Promise.reject(error); | ||||
|                     if (domain && domain != url) { | ||||
|                         return this.sitesProvider.checkSite(domain).catch((secondError) => { | ||||
|                             // Try to use the first error.
 | ||||
|                             return Promise.reject(error || secondError); | ||||
|                         }); | ||||
|                     } | ||||
| 
 | ||||
|                     return Promise.reject(error); | ||||
|                 }) | ||||
|                 .then((result) => this.login(result)) | ||||
|                 .catch((error) => this.showLoginIssue(url, error)) | ||||
|  | ||||
| @ -572,6 +572,11 @@ export class CoreSitesProvider { | ||||
|             return Promise.reject({error: this.translate.instant('core.cannotconnect', {$a: CoreSite.MINIMUM_MOODLE_VERSION})}); | ||||
|         }).then((data: any) => { | ||||
| 
 | ||||
|             if (data === null) { | ||||
|                 // Cannot connect.
 | ||||
|                 return Promise.reject({error: this.translate.instant('core.cannotconnect', {$a: CoreSite.MINIMUM_MOODLE_VERSION})}); | ||||
|             } | ||||
| 
 | ||||
|             if (data.errorcode && (data.errorcode == 'enablewsdescription' || data.errorcode == 'requirecorrectaccess')) { | ||||
|                 return Promise.reject({ errorcode: data.errorcode, error: data.error }); | ||||
|             } else if (data.error && data.error == 'Web services must be enabled in Advanced features.') { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user