MOBILE-4485 login: Fix invalid login message
This commit is contained in:
parent
fb1600aa66
commit
35cda384b0
@ -56,6 +56,7 @@ import {
|
||||
IDENTITY_PROVIDER_FEATURE_NAME_PREFIX,
|
||||
} from '../constants';
|
||||
import { LazyRoutesModule } from '@/app/app-routing.module';
|
||||
import { CoreSiteError } from '@classes/errors/siteerror';
|
||||
|
||||
/**
|
||||
* Helper provider that provides some common features regarding authentication.
|
||||
@ -933,8 +934,10 @@ export class CoreLoginHelperProvider {
|
||||
/**
|
||||
* Show a modal warning that the credentials introduced were not correct.
|
||||
*/
|
||||
protected showInvalidLoginModal(error: CoreWSError): void {
|
||||
CoreDomUtils.showErrorModal(error.message);
|
||||
protected showInvalidLoginModal(error: CoreError): void {
|
||||
const errorDetails = error instanceof CoreSiteError ? error.debug?.details : null;
|
||||
|
||||
CoreDomUtils.showErrorModal(errorDetails ?? error.message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1074,8 +1077,10 @@ export class CoreLoginHelperProvider {
|
||||
* @param username Username.
|
||||
* @param password User password.
|
||||
*/
|
||||
treatUserTokenError(siteUrl: string, error: CoreWSError, username?: string, password?: string): void {
|
||||
switch (error.errorcode) {
|
||||
treatUserTokenError(siteUrl: string, error: CoreError, username?: string, password?: string): void {
|
||||
const errorCode = 'errorcode' in error ? error.errorcode : null;
|
||||
|
||||
switch (errorCode) {
|
||||
case 'forcepasswordchangenotice':
|
||||
this.openChangePassword(siteUrl, CoreTextUtils.getErrorMessageFromError(error) ?? '');
|
||||
break;
|
||||
|
@ -47,6 +47,16 @@ Feature: Test basic usage of login in app
|
||||
And I press "Connect to your site" in the app
|
||||
Then I should find "Can't connect to site" in the app
|
||||
|
||||
Scenario: Attempt invalid login
|
||||
When I launch the app
|
||||
And I set the field "Your site" to "$WWWROOT" in the app
|
||||
And I press "Connect to your site" in the app
|
||||
And I set the following fields to these values in the app:
|
||||
| Username | student1 |
|
||||
| Password | wrongpassword |
|
||||
And I press "Log in" near "Lost password?" in the app
|
||||
Then I should find "Invalid login" in the app
|
||||
|
||||
Scenario: Add a non existing account from accounts switcher
|
||||
Given I entered the app as "student1"
|
||||
And I press the user menu button in the app
|
||||
|
Loading…
x
Reference in New Issue
Block a user