MOBILE-4059 login: Treat invalidlogin error
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) {
|
||||||
this.openChangePassword(siteUrl, CoreTextUtils.getErrorMessageFromError(error)!);
|
case 'forcepasswordchangenotice':
|
||||||
} else if (error.errorcode == 'usernotconfirmed') {
|
this.openChangePassword(siteUrl, CoreTextUtils.getErrorMessageFromError(error)!);
|
||||||
this.showNotConfirmedModal(siteUrl, undefined, username, password);
|
break;
|
||||||
} else if (error.errorcode == 'connecttomoodleapp') {
|
case 'usernotconfirmed':
|
||||||
this.showMoodleAppNoticeModal(CoreTextUtils.getErrorMessageFromError(error)!);
|
this.showNotConfirmedModal(siteUrl, undefined, username, password);
|
||||||
} else if (error.errorcode == 'connecttoworkplaceapp') {
|
break;
|
||||||
this.showWorkplaceNoticeModal(CoreTextUtils.getErrorMessageFromError(error)!);
|
case 'connecttomoodleapp':
|
||||||
} else {
|
this.showMoodleAppNoticeModal(CoreTextUtils.getErrorMessageFromError(error)!);
|
||||||
CoreDomUtils.showErrorModal(error);
|
break;
|
||||||
|
case 'connecttoworkplaceapp':
|
||||||
|
this.showWorkplaceNoticeModal(CoreTextUtils.getErrorMessageFromError(error)!);
|
||||||
|
break;
|
||||||
|
case 'invalidlogin':
|
||||||
|
this.showInvalidLoginModal(error);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CoreDomUtils.showErrorModal(error);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue