Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-672 [created] 71754deb5


[USERGRID-672] Remove password properties from user objects in portal


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/71754deb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/71754deb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/71754deb

Branch: refs/heads/USERGRID-672
Commit: 71754deb58eb91e260e0d73feb0efafd94f3d79f
Parents: b28aeee
Author: ryan bridges <[email protected]>
Authored: Thu May 21 12:17:01 2015 -0400
Committer: ryan bridges <[email protected]>
Committed: Thu May 21 12:18:23 2015 -0400

----------------------------------------------------------------------
 portal/js/users/users-controller.js | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/71754deb/portal/js/users/users-controller.js
----------------------------------------------------------------------
diff --git a/portal/js/users/users-controller.js 
b/portal/js/users/users-controller.js
index fa489f7..3978357 100644
--- a/portal/js/users/users-controller.js
+++ b/portal/js/users/users-controller.js
@@ -61,15 +61,29 @@ AppServices.Controllers.controller('UsersCtrl', ['ug', 
'$scope', '$rootScope', '
           clearNewUserForm();
           break;
       }
-    }
+    };
 
     ug.getUsers();
+    function sanitizeUsersCollection(){
+      var cleanProperties = ["password", "oldpassword", "newpassword"]
+      if($scope.usersCollection._list.length > 0){
+        $scope.usersCollection._list.forEach(function(user, i){
+          Object.keys(user._data).forEach(function(key){
+            if(cleanProperties.indexOf(key.toLowerCase()) !== -1){
+              // console.warn("Removing %s from %s", key, user._data.uuid);
+              delete user._data[key]
+            }
+          });
+          $scope.usersCollection._list[i]=user;
+        })
+      }
+    }
 
     $scope.$on('users-received', function(event, users) {
       $scope.usersCollection = users;
       $scope.usersSelected = false;
       $scope.hasUsers = users._list.length;
-
+      sanitizeUsersCollection();
       if(users._list.length > 0){
         $scope.selectUser(users._list[0]._data.uuid)
       }
@@ -79,6 +93,7 @@ AppServices.Controllers.controller('UsersCtrl', ['ug', 
'$scope', '$rootScope', '
     });
 
     $scope.$on('users-create-success', function () {
+      sanitizeUsersCollection();
       $rootScope.$broadcast("alert", "success", "User successfully created.");
     });
 

Reply via email to