summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2018-03-14 15:37:44 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-03-23 19:57:11 +0000
commit55a8e3916230962ef0e74a78bd805e0b015ed5b2 (patch)
tree86911953f9c7cfe24398a4211db681b1578d4160
parent1a60f6efdb9e7e43d5b82bd7957a21adcd253572 (diff)
downloadphosphor-webui-55a8e3916230962ef0e74a78bd805e0b015ed5b2.tar.gz
phosphor-webui-55a8e3916230962ef0e74a78bd805e0b015ed5b2.zip
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>
-rw-r--r--app/common/services/api-utils.js24
1 files changed, 24 insertions, 0 deletions
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 @@ window.angular && (function (angular) {
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',
OpenPOWER on IntegriCloud