2019-12-07 21:02:00 +02:00
|
|
|
import logger from 'app/services/logger';
|
2017-04-13 08:49:02 +03:00
|
|
|
|
2016-03-01 22:36:14 +02:00
|
|
|
import AbstractState from './AbstractState';
|
|
|
|
import LoginState from './LoginState';
|
2016-05-14 23:53:58 +03:00
|
|
|
import RecoverPasswordState from './RecoverPasswordState';
|
2016-03-01 22:36:14 +02:00
|
|
|
|
|
|
|
export default class ForgotPasswordState extends AbstractState {
|
2019-11-27 11:03:32 +02:00
|
|
|
enter(context) {
|
|
|
|
context.navigate('/forgot-password');
|
|
|
|
}
|
2016-05-14 23:53:58 +03:00
|
|
|
|
2019-12-07 13:28:52 +02:00
|
|
|
resolve(
|
|
|
|
context,
|
|
|
|
payload: {
|
|
|
|
login?: string;
|
|
|
|
} = {},
|
|
|
|
) {
|
2019-11-27 11:03:32 +02:00
|
|
|
context
|
|
|
|
.run('forgotPassword', payload)
|
|
|
|
.then(() => {
|
|
|
|
context.run('setLogin', payload.login);
|
|
|
|
context.setState(new RecoverPasswordState());
|
|
|
|
})
|
|
|
|
.catch(
|
|
|
|
(err = {}) =>
|
|
|
|
err.errors ||
|
|
|
|
logger.warn('Error requesting password recoverage', err),
|
|
|
|
);
|
|
|
|
}
|
2016-03-01 22:36:14 +02:00
|
|
|
|
2019-11-27 11:03:32 +02:00
|
|
|
goBack(context) {
|
|
|
|
context.setState(new LoginState());
|
|
|
|
}
|
2016-03-01 22:36:14 +02:00
|
|
|
|
2019-11-27 11:03:32 +02:00
|
|
|
reject(context) {
|
|
|
|
context.setState(new RecoverPasswordState());
|
|
|
|
}
|
2016-03-01 22:36:14 +02:00
|
|
|
}
|