diff --git a/app/pods/protected/users/changepassword/controller.js b/app/pods/protected/users/changepassword/controller.js index 9119f1a..638961f 100644 --- a/app/pods/protected/users/changepassword/controller.js +++ b/app/pods/protected/users/changepassword/controller.js @@ -1,4 +1,5 @@ import Ember from 'ember'; +import ajaxErrorNew from '../../../../utils/ajax-error-new'; const { Controller, inject: { service } } = Ember; @@ -11,9 +12,12 @@ export default Controller.extend({ save: function(password) { const id = this.get('currentUser.account.id'); const data = { id: id, password: password }; - this.get('ajax').post('/users/password', { data: data }); - this.transitionToRoute('protected.users.show', id); - this.get('flashMessages').information('Your password has been changed.'); + this.get('ajax').post('/users/password', { data: data }).then(() => { + this.transitionToRoute('protected.users.show', id); + this.get('flashMessages').information('Your password has been changed.'); + }, (error) => { + ajaxErrorNew(error, this.get('flashMessages')); + }); }, cancel: function() {