Set password as default authentication method on error

This commit is contained in:
Giuseppe Digilio
2020-02-07 14:12:14 +01:00
parent 03c1b689f8
commit 573a9b8de3
3 changed files with 9 additions and 2 deletions

View File

@@ -355,6 +355,11 @@ export class RetrieveAuthMethodsSuccessAction implements Action {
} }
} }
/**
* Set password as default authentication method on error
* @class RetrieveAuthMethodsErrorAction
* @implements {Action}
*/
export class RetrieveAuthMethodsErrorAction implements Action { export class RetrieveAuthMethodsErrorAction implements Action {
public type: string = AuthActionTypes.RETRIEVE_AUTH_METHODS_ERROR; public type: string = AuthActionTypes.RETRIEVE_AUTH_METHODS_ERROR;
} }

View File

@@ -469,7 +469,7 @@ describe('authReducer', () => {
authenticated: false, authenticated: false,
loaded: false, loaded: false,
loading: false, loading: false,
authMethods: [] authMethods: [new AuthMethod(AuthMethodType.Password)]
}; };
expect(newState).toEqual(state); expect(newState).toEqual(state);
}); });

View File

@@ -16,6 +16,7 @@ import {
import { EPerson } from '../eperson/models/eperson.model'; import { EPerson } from '../eperson/models/eperson.model';
import { AuthTokenInfo } from './models/auth-token-info.model'; import { AuthTokenInfo } from './models/auth-token-info.model';
import { AuthMethod } from './models/auth.method'; import { AuthMethod } from './models/auth.method';
import { AuthMethodType } from './models/auth.method-type';
/** /**
* The auth state. * The auth state.
@@ -199,7 +200,8 @@ export function authReducer(state: any = initialState, action: AuthActions): Aut
case AuthActionTypes.RETRIEVE_AUTH_METHODS_ERROR: case AuthActionTypes.RETRIEVE_AUTH_METHODS_ERROR:
return Object.assign({}, state, { return Object.assign({}, state, {
loading: false loading: false,
authMethods: [new AuthMethod(AuthMethodType.Password)]
}); });
case AuthActionTypes.SET_REDIRECT_URL: case AuthActionTypes.SET_REDIRECT_URL: