forked from EVOgeek/Vmeda.Online
		
	MOBILE-4059 login: Treat invalidlogin error
This commit is contained in:
		
							parent
							
								
									001a19f066
								
							
						
					
					
						commit
						8b8c4d533a
					
				| @ -39,6 +39,7 @@ import { CorePushNotifications } from '@features/pushnotifications/services/push | |||||||
| import { CoreText } from '@singletons/text'; | import { CoreText } from '@singletons/text'; | ||||||
| import { CorePromisedValue } from '@classes/promised-value'; | import { CorePromisedValue } from '@classes/promised-value'; | ||||||
| import { SafeHtml } from '@angular/platform-browser'; | import { SafeHtml } from '@angular/platform-browser'; | ||||||
|  | import { CoreLoginError } from '@classes/errors/loginerror'; | ||||||
| 
 | 
 | ||||||
| const PASSWORD_RESETS_CONFIG_KEY = 'password-resets'; | const PASSWORD_RESETS_CONFIG_KEY = 'password-resets'; | ||||||
| 
 | 
 | ||||||
| @ -1026,6 +1027,13 @@ export class CoreLoginHelperProvider { | |||||||
|             (!CoreConstants.CONFIG.skipssoconfirmation || String(CoreConstants.CONFIG.skipssoconfirmation) === 'false'); |             (!CoreConstants.CONFIG.skipssoconfirmation || String(CoreConstants.CONFIG.skipssoconfirmation) === 'false'); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Show a modal warning that the credentials introduced were not correct. | ||||||
|  |      */ | ||||||
|  |     protected showInvalidLoginModal(error: CoreLoginError): void { | ||||||
|  |         CoreDomUtils.showErrorModal(error.errorDetails ?? error.message); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * Show a modal warning the user that he should use the Workplace app. |      * Show a modal warning the user that he should use the Workplace app. | ||||||
|      * |      * | ||||||
| @ -1167,16 +1175,25 @@ export class CoreLoginHelperProvider { | |||||||
|      * @param password User password. |      * @param password User password. | ||||||
|      */ |      */ | ||||||
|     treatUserTokenError(siteUrl: string, error: CoreWSError, username?: string, password?: string): void { |     treatUserTokenError(siteUrl: string, error: CoreWSError, username?: string, password?: string): void { | ||||||
|         if (error.errorcode == 'forcepasswordchangenotice') { |         switch (error.errorcode) { | ||||||
|  |             case 'forcepasswordchangenotice': | ||||||
|                 this.openChangePassword(siteUrl, CoreTextUtils.getErrorMessageFromError(error)!); |                 this.openChangePassword(siteUrl, CoreTextUtils.getErrorMessageFromError(error)!); | ||||||
|         } else if (error.errorcode == 'usernotconfirmed') { |                 break; | ||||||
|  |             case 'usernotconfirmed': | ||||||
|                 this.showNotConfirmedModal(siteUrl, undefined, username, password); |                 this.showNotConfirmedModal(siteUrl, undefined, username, password); | ||||||
|         } else if (error.errorcode == 'connecttomoodleapp') { |                 break; | ||||||
|  |             case 'connecttomoodleapp': | ||||||
|                 this.showMoodleAppNoticeModal(CoreTextUtils.getErrorMessageFromError(error)!); |                 this.showMoodleAppNoticeModal(CoreTextUtils.getErrorMessageFromError(error)!); | ||||||
|         } else if (error.errorcode == 'connecttoworkplaceapp') { |                 break; | ||||||
|  |             case 'connecttoworkplaceapp': | ||||||
|                 this.showWorkplaceNoticeModal(CoreTextUtils.getErrorMessageFromError(error)!); |                 this.showWorkplaceNoticeModal(CoreTextUtils.getErrorMessageFromError(error)!); | ||||||
|         } else { |                 break; | ||||||
|  |             case 'invalidlogin': | ||||||
|  |                 this.showInvalidLoginModal(error); | ||||||
|  |                 break; | ||||||
|  |             default: | ||||||
|                 CoreDomUtils.showErrorModal(error); |                 CoreDomUtils.showErrorModal(error); | ||||||
|  |                 break; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user