Skip to content

Commit

Permalink
feat(account-editor): update password via new api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Oct 3, 2019
1 parent 88ab1bc commit 7d279e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/account/AccountEditor.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/account/account.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 7d279e9

Please sign in to comment.