Add function to change user password
Added changePassword() that changes the given user's password.
This function is used in follow-on commits.
Tested: Verified this funciton works.
Change-Id: I0a5ec12f7ef0beb90eeeb97e3a117d9856d184d0
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 3e0c59e..7557540 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -211,6 +211,30 @@
console.log(error);
});
},
+ changePassword: function(user, newPassword){
+ var deferred = $q.defer();
+ $http({
+ method: 'POST',
+ url: DataService.getHost() + "/xyz/openbmc_project/user/" + user + "/action/SetPassword",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ withCredentials: true,
+ data: JSON.stringify({"data": [newPassword]}),
+ responseType: 'arraybuffer'
+ }).then(function(response, status, headers){
+ deferred.resolve({
+ data: response,
+ status: status,
+ headers: headers
+ });
+ }, function(error){
+ console.log(error);
+ deferred.reject(error);
+ });
+ return deferred.promise;
+ },
chassisPowerOn: function(callback){
$http({
method: 'POST',