mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-12 19:25:54 +05:30
Update password change time immediately after successful update
This commit is contained in:
parent
e2a782f0b7
commit
8e90c4434e
@ -25,6 +25,7 @@ class ChangePasswordPage extends Component {
|
||||
import { connect } from 'react-redux';
|
||||
import { routeActions } from 'react-router-redux';
|
||||
import { register as registerPopup, create as createPopup } from 'components/ui/popup/actions';
|
||||
import { updateUser } from 'components/user/actions';
|
||||
|
||||
function goToProfile() {
|
||||
return routeActions.push('/');
|
||||
@ -37,11 +38,17 @@ export default connect(null, {
|
||||
dispatch(createPopup('requestPassword', (props) => {
|
||||
return {
|
||||
onSubmit: (password) => {
|
||||
// TODO: hide this logic in action and do not forget to update password change time
|
||||
// TODO: hide this logic in action
|
||||
accounts.changePassword({
|
||||
...data,
|
||||
password
|
||||
})
|
||||
.then(() => {
|
||||
dispatch(updateUser({
|
||||
passwordChangedAt: Date.now() / 1000,
|
||||
shouldChangePassword: false
|
||||
}));
|
||||
})
|
||||
.then(props.onClose)
|
||||
.then(() => dispatch(goToProfile()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user