#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 AbstractState from './AbstractState';
import LoginState from './LoginState'; import LoginState from './LoginState';
import CompleteState from './CompleteState';
import RecoverPasswordState from './RecoverPasswordState'; import RecoverPasswordState from './RecoverPasswordState';
export default class ForgotPasswordState extends AbstractState { export default class ForgotPasswordState extends AbstractState {
enter(context) { enter(context) {
if (this.getLogin(context)) {
context.navigate('/forgot-password'); context.navigate('/forgot-password');
} else {
context.setState(new CompleteState());
}
} }
resolve(context, payload = {}) { resolve(context, payload = {}) {

View File

@ -2,7 +2,6 @@ import sinon from 'sinon';
import ForgotPasswordState from 'services/authFlow/ForgotPasswordState'; import ForgotPasswordState from 'services/authFlow/ForgotPasswordState';
import RecoverPasswordState from 'services/authFlow/RecoverPasswordState'; import RecoverPasswordState from 'services/authFlow/RecoverPasswordState';
import CompleteState from 'services/authFlow/CompleteState';
import LoginState from 'services/authFlow/LoginState'; import LoginState from 'services/authFlow/LoginState';
import { bootstrap, expectState, expectNavigate, expectRun } from './helpers'; import { bootstrap, expectState, expectNavigate, expectRun } from './helpers';
@ -26,24 +25,10 @@ describe('ForgotPasswordState', () => {
describe('#enter', () => { describe('#enter', () => {
it('should navigate to /forgot-password if login set', () => { it('should navigate to /forgot-password if login set', () => {
context.getState.returns({
auth: {login: 'foo@bar.com'}
});
expectNavigate(mock, '/forgot-password'); expectNavigate(mock, '/forgot-password');
state.enter(context); state.enter(context);
}); });
it('should transition to complete if no login', () => {
context.getState.returns({
auth: {}
});
expectState(mock, CompleteState);
state.enter(context);
});
}); });
describe('#resolve', () => { describe('#resolve', () => {