#327: allow forgot-password access without login data

This commit is contained in:
SleepWalker 2017-04-18 07:32:17 +03:00
parent bd14b3842b
commit 258c0a7a5f
2 changed files with 1 additions and 21 deletions

View File

@ -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 = {}) {

View File

@ -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', () => {