mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-25 22:50:04 +05:30
#327: allow forgot-password access without login data
This commit is contained in:
parent
bd14b3842b
commit
258c0a7a5f
@ -2,16 +2,11 @@ import logger from 'services/logger';
|
||||
|
||||
import AbstractState from './AbstractState';
|
||||
import LoginState from './LoginState';
|
||||
import CompleteState from './CompleteState';
|
||||
import RecoverPasswordState from './RecoverPasswordState';
|
||||
|
||||
export default class ForgotPasswordState extends AbstractState {
|
||||
enter(context) {
|
||||
if (this.getLogin(context)) {
|
||||
context.navigate('/forgot-password');
|
||||
} else {
|
||||
context.setState(new CompleteState());
|
||||
}
|
||||
context.navigate('/forgot-password');
|
||||
}
|
||||
|
||||
resolve(context, payload = {}) {
|
||||
|
@ -2,7 +2,6 @@ import sinon from 'sinon';
|
||||
|
||||
import ForgotPasswordState from 'services/authFlow/ForgotPasswordState';
|
||||
import RecoverPasswordState from 'services/authFlow/RecoverPasswordState';
|
||||
import CompleteState from 'services/authFlow/CompleteState';
|
||||
import LoginState from 'services/authFlow/LoginState';
|
||||
|
||||
import { bootstrap, expectState, expectNavigate, expectRun } from './helpers';
|
||||
@ -26,24 +25,10 @@ describe('ForgotPasswordState', () => {
|
||||
|
||||
describe('#enter', () => {
|
||||
it('should navigate to /forgot-password if login set', () => {
|
||||
context.getState.returns({
|
||||
auth: {login: 'foo@bar.com'}
|
||||
});
|
||||
|
||||
expectNavigate(mock, '/forgot-password');
|
||||
|
||||
state.enter(context);
|
||||
});
|
||||
|
||||
it('should transition to complete if no login', () => {
|
||||
context.getState.returns({
|
||||
auth: {}
|
||||
});
|
||||
|
||||
expectState(mock, CompleteState);
|
||||
|
||||
state.enter(context);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#resolve', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user