From 031a83808c509f617235db9053d33afa3108e37c Mon Sep 17 00:00:00 2001
From: Matthew Dillon <mrdillon@alaska.edu>
Date: Fri, 13 Nov 2015 13:43:55 -0700
Subject: [PATCH] Handle password change errors

---
 app/pods/protected/users/changepassword/controller.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

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() {