From df5a50b1e28220d144f0473029252e798e547716 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 2 Dec 2015 10:13:22 -0700 Subject: [PATCH] Use ajax error service in password reset --- app/pods/protected/users/changepassword/controller.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/pods/protected/users/changepassword/controller.js b/app/pods/protected/users/changepassword/controller.js index 638961f..ddfd685 100644 --- a/app/pods/protected/users/changepassword/controller.js +++ b/app/pods/protected/users/changepassword/controller.js @@ -1,11 +1,11 @@ import Ember from 'ember'; -import ajaxErrorNew from '../../../../utils/ajax-error-new'; const { Controller, inject: { service } } = Ember; export default Controller.extend({ session: service(), ajax: service(), + ajaxError: service('ajax-error'), currentUser: service('session-account'), actions: { @@ -15,12 +15,13 @@ export default Controller.extend({ 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')); + }, (errors) => { + this.get('ajaxError').alert(errors); }); }, cancel: function() { + this.get('flashMessages').clearMessages(); this.transitionToRoute('protected.users.show', this.get('currentUser.account.id')); }, },