Login route improvement
diff --git a/views/ngXosViews/subscriberPortal/src/app/view/login/login.js b/views/ngXosViews/subscriberPortal/src/app/view/login/login.js
index eae16d5..1d50b20 100644
--- a/views/ngXosViews/subscriberPortal/src/app/view/login/login.js
+++ b/views/ngXosViews/subscriberPortal/src/app/view/login/login.js
@@ -15,32 +15,39 @@
  */
 
 (function () {
-    'use strict';
-    var urlSuffix = '/rs/login';
+  'use strict';
+  var urlSuffix = '/rs/login';
 
-    angular.module('cordLogin', [])
-        .controller('CordLoginCtrl',
-        ['$log', '$scope', '$resource', '$location', '$window',
-            function ($log, $scope, $resource, $location, $window) {
-                var LoginData, resource;
-                $scope.page.curr = 'login';
+  angular.module('cordLogin', [])
+    .controller('CordLoginCtrl', [
+      '$log', '$scope', '$resource', '$location', '$window', 'User',
+      function ($log, $scope, $resource, $location, $window, User) {
+        var LoginData, resource;
+        $scope.page.curr = 'login';
 
-                function getResource(email) {
-                    LoginData = $resource($scope.shared.url + urlSuffix + '/' + email);
-                    resource = LoginData.get({},
-                        function () {
-                            $location.url('/home');
-                            $window.location.href = $location.absUrl();
-                        });
-                }
+        function getResource(email) {
+          LoginData = $resource($scope.shared.url + urlSuffix + '/' + email);
+          resource = LoginData.get({},
+            function () {
+              $location.url('/home');
+              $window.location.href = $location.absUrl();
+            });
+        }
 
-                $scope.login = function () {
-                    if ($scope.email && $scope.password) {
-                        getResource($scope.email);
-                        $scope.shared.login = $scope.email;
-                    }
-                };
+        $scope.login = function () {
+          if ($scope.email && $scope.password) {
+            //getResource($scope.email);
 
-                $log.debug('Cord Login Ctrl has been created.');
-        }]);
+            User.login($scope.email, $scope.password)
+            .then(function(user){
+              console.log(user);
+              $location.url('/home');
+            });
+
+            $scope.shared.login = $scope.email;
+          }
+        };
+
+        $log.debug('Cord Login Ctrl has been created.');
+      }]);
 }());
diff --git a/views/ngXosViews/subscriberPortal/src/app/view/user/user.html b/views/ngXosViews/subscriberPortal/src/app/view/user/user.html
index d8a0620..9822b57 100644
--- a/views/ngXosViews/subscriberPortal/src/app/view/user/user.html
+++ b/views/ngXosViews/subscriberPortal/src/app/view/user/user.html
@@ -19,21 +19,17 @@
         </div>
 
         <div class="main-right" ng-class="{family: isFamily}">
-            <form ng-if="isFamily"
-                  name="changeLevels">
+            <form ng-if="isFamily" name="changeLevels">
                 <table class="user-form">
                     <tr>
                         <th>
                             Select Site Rating
-                            <span class="help"
-                                  ng-click="showRatings()"> (?)</span>
+                            <span class="help" ng-click="showRatings()"> (?)</span>
                         </th>
                     </tr>
                     <tr ng-repeat="user in users" class="options">
                         <td>
-                            <select ng-init="newLevels[user.id]=user.profile.url_filter.level"
-                                    ng-model="newLevels[user.id]"
-                                    ng-options="l for l in levels">
+                            <select ng-model="user.level" ng-options="l for l in levels" ng-change="updateLevel(user)">
                             </select>
                         </td>
                     </tr>
diff --git a/views/ngXosViews/subscriberPortal/src/app/view/user/user.js b/views/ngXosViews/subscriberPortal/src/app/view/user/user.js
index 4d69269..ecdf970 100644
--- a/views/ngXosViews/subscriberPortal/src/app/view/user/user.js
+++ b/views/ngXosViews/subscriberPortal/src/app/view/user/user.js
@@ -58,13 +58,6 @@
             // add an icon to the user
             res.users.map(function(user){
               user['icon_id'] = 'mom';
-              // NOTE mock data, waiting for #CORD-516
-              var levels = ['R', 'PG', 'PG-13'];
-              user.profile = {
-                url_filter: {
-                  level: levels[Math.floor(Math.random() * levels.length)]
-                }
-              };
               return user;
             });
 
@@ -81,6 +74,43 @@
             $log.error('Problem with resource', bundleResource);
           });
 
+        $scope.updateLevel = function(user){
+          console.log(user);
+          user.$save()
+            .then(function(){
+              console.log('saved');
+            })
+            .catch(function(e){
+              throw new Error(e);
+            });
+        };
+
+        //function getUsers(url) {
+        //  var UserData, userResource;
+        //  UserData = $resource(url);
+        //  userResource = UserData.get({},
+        //    // success
+        //    function () {
+        //      $scope.users = userResource.users;
+        //      if ($.isEmptyObject($scope.shared.userActivity)) {
+        //        $scope.users.forEach(function (user) {
+        //          var date = randomDate(new Date(2015, 0, 1),
+        //            new Date());
+        //
+        //          $scope.shared.userActivity[user.id] =
+        //            $filter('date')(date, 'mediumTime');
+        //        });
+        //      }
+        //    },
+        //    // error
+        //    function () {
+        //      $log.error('Problem with resource', userResource);
+        //    }
+        //  );
+        //}
+        //
+        //getUsers($scope.shared.url + userUrlSuffix);
+
         // === Form functions ---
 
         function levelUrl(id, level) {
@@ -88,6 +118,7 @@
             userUrlSuffix + '/' + id + '/apply/url_filter/level/' + level;
         }
 
+        // NOTE This will trigger one request for each user to update url_filter level
         $scope.applyChanges = function (changeLevels) {
           var requests = [];