accounts-frontend/src/services/authFlow/RecoverPasswordState.js

32 lines
878 B
JavaScript
Raw Normal View History

import AbstractState from './AbstractState';
import LoginState from './LoginState';
import CompleteState from './CompleteState';
export default class RecoverPasswordState extends AbstractState {
enter(context) {
const {user, routing} = context.getState();
if (user.isGuest) {
2016-06-05 17:46:41 +05:30
const url = routing.location.pathname.includes('/recover-password')
? routing.location.pathname
: '/recover-password';
context.navigate(url);
} else {
context.setState(new CompleteState());
}
}
resolve(context, payload) {
context.run('recoverPassword', payload)
.then(() => context.setState(new CompleteState()));
}
goBack(context) {
context.setState(new LoginState());
}
reject(context) {
context.navigate('/send-message');
}
}