Skip to content

Commit

Permalink
#67 Fix password change
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Mar 30, 2018
1 parent f8623c1 commit 9783f26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 2 additions & 1 deletion www/src/app/core/services/common/UserService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
8 changes: 1 addition & 7 deletions www/src/app/pages/settings/settings.page.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 9783f26

Please sign in to comment.