diff --git a/www/src/app/core/services/common/UserService.js b/www/src/app/core/services/common/UserService.js index d95d47cb4..8e40a05f2 100644 --- a/www/src/app/core/services/common/UserService.js +++ b/www/src/app/core/services/common/UserService.js @@ -53,9 +53,10 @@ export default class UserService { return defer.promise; } - changePass(id, password) { + changePass(id, currentPassword, password) { return this.$http .post(`./api/user/${id}/password/change`, { + currentPassword: currentPassword, password: password }) .then(response => this.$q.resolve(response.data)) diff --git a/www/src/app/pages/settings/settings.page.controller.js b/www/src/app/pages/settings/settings.page.controller.js index 52381e988..9fd1a60e1 100644 --- a/www/src/app/pages/settings/settings.page.controller.js +++ b/www/src/app/pages/settings/settings.page.controller.js @@ -88,18 +88,12 @@ export default class SettingsPageController { return; } - let updatedFields = {}; if ( this.passData.currentPassword && this.passData.password !== '' && this.passData.password === this.passData.passwordConfirm ) { - updatedFields.currentPassword = this.passData.currentPassword; - updatedFields.password = this.passData.password; - } - - if (updatedFields !== {}) { - this.UserService.changePass(this.currentUser.id, updatedFields) + this.UserService.changePass(this.currentUser.id, this.passData.currentPassword, this.passData.password) .then(() => { this.NotificationService.log( 'Your password has been successfully updated',