mirror of
				https://github.com/elyby/accounts-frontend.git
				synced 2025-05-31 14:11:58 +05:30 
			
		
		
		
	Update password change time immediately after successful update
This commit is contained in:
		| @@ -25,6 +25,7 @@ class ChangePasswordPage extends Component { | |||||||
| import { connect } from 'react-redux'; | import { connect } from 'react-redux'; | ||||||
| import { routeActions } from 'react-router-redux'; | import { routeActions } from 'react-router-redux'; | ||||||
| import { register as registerPopup, create as createPopup } from 'components/ui/popup/actions'; | import { register as registerPopup, create as createPopup } from 'components/ui/popup/actions'; | ||||||
|  | import { updateUser } from 'components/user/actions'; | ||||||
|  |  | ||||||
| function goToProfile() { | function goToProfile() { | ||||||
|     return routeActions.push('/'); |     return routeActions.push('/'); | ||||||
| @@ -37,11 +38,17 @@ export default connect(null, { | |||||||
|             dispatch(createPopup('requestPassword', (props) => { |             dispatch(createPopup('requestPassword', (props) => { | ||||||
|                 return { |                 return { | ||||||
|                     onSubmit: (password) => { |                     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({ |                         accounts.changePassword({ | ||||||
|                             ...data, |                             ...data, | ||||||
|                             password |                             password | ||||||
|                         }) |                         }) | ||||||
|  |                         .then(() => { | ||||||
|  |                             dispatch(updateUser({ | ||||||
|  |                                 passwordChangedAt: Date.now() / 1000, | ||||||
|  |                                 shouldChangePassword: false | ||||||
|  |                             })); | ||||||
|  |                         }) | ||||||
|                         .then(props.onClose) |                         .then(props.onClose) | ||||||
|                         .then(() => dispatch(goToProfile())); |                         .then(() => dispatch(goToProfile())); | ||||||
|                     } |                     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user