diff --git a/src/account/AccountEditor.component.js b/src/account/AccountEditor.component.js index d69f6e2d..873a2b4b 100644 --- a/src/account/AccountEditor.component.js +++ b/src/account/AccountEditor.component.js @@ -66,7 +66,7 @@ class AccountEditor extends Component { } else if (!this.isNotEmpty(this.state.newPassword) || !this.isNotEmpty(this.state.reNewPassword)) { appActions.showSnackbarMessage({ message: this.context.d2.i18n.getTranslation('password_do_not_match'), status:'error'}); } else { - accountActions.setPassword(this.state.newPassword, this.clearRepeatPassword); + accountActions.setPassword(this.state.oldPassword, this.state.newPassword, this.clearRepeatPassword); } } diff --git a/src/account/account.actions.js b/src/account/account.actions.js index f1a1e34e..62bcf77d 100644 --- a/src/account/account.actions.js +++ b/src/account/account.actions.js @@ -12,11 +12,12 @@ const accountActions = Action.createActionsFromNames([ 'getQrCode', ]); -accountActions.setPassword.subscribe(({ data: [password, onSuccess], complete, error }) => { - const payload = { userCredentials: { password } }; +accountActions.setPassword.subscribe(({ data: [oldPassword, newPassword, onSuccess], complete, error }) => { + const payload = { oldPassword, newPassword }; + getD2().then((d2) => { const api = d2.Api.getApi(); - api.update('/me', payload) + api.update('/me/changePassword', payload) .then(() => { log.debug('Password updated successfully.'); appActions.showSnackbarMessage({