summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2018-03-28 16:16:58 -0500
committerGunnar Mills <gmills@us.ibm.com>2018-04-02 16:00:04 +0000
commit7c3e8c1d0c24f499c7140b8df6ed8114597514c1 (patch)
treebbf05d3bb878ce180c5073bfd5ca013d9c8ef291
parent959d8c1f2da703bcb5dbfcc919178d38db8609ae (diff)
downloadphosphor-webui-7c3e8c1d0c24f499c7140b8df6ed8114597514c1.tar.gz
phosphor-webui-7c3e8c1d0c24f499c7140b8df6ed8114597514c1.zip
Return http promise on testPassword
Instead of creating a new promise with q.defer(), just return the http promise. This is much simpler and the recommended solution. Tested: Changed the password and verified the wrong old password returned an error on a Witherspoon. Change-Id: I1b412426da58ec3185f6d83bd53fdc984c7785e8 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rw-r--r--app/common/services/api-utils.js12
1 files changed, 2 insertions, 10 deletions
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index bc89eb1..980f1a2 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -193,8 +193,7 @@ window.angular && (function (angular) {
// Calls /login without the current session to verify the given password is correct
// ignore the interceptor logout on a bad password
DataService.ignoreHttpError = true;
- var deferred = $q.defer();
- $http({
+ return $http({
method: 'POST',
url: DataService.getHost() + "/login",
headers: {
@@ -204,15 +203,8 @@ window.angular && (function (angular) {
withCredentials: false,
data: JSON.stringify({"data": [username, password]})
}).then(function(response){
- var json = JSON.stringify(response.data);
- var content = JSON.parse(json);
- DataService.ignoreHttpError = false;
- deferred.resolve(content.data);
- }, function(error){
- DataService.ignoreHttpError = false;
- deferred.reject(error);
+ return response.data;
});
- return deferred.promise;
},
logout: function(callback){
$http({
OpenPOWER on IntegriCloud