client/app/auth/auth_controller.js
changeset 113 b8400d8efac8
parent 100 537d330ad7f0
child 169 76fb2dd72ce4
--- a/client/app/auth/auth_controller.js	Thu Jun 04 20:08:01 2015 +0200
+++ b/client/app/auth/auth_controller.js	Thu Jun 04 20:09:20 2015 +0200
@@ -14,11 +14,11 @@
     })
     .controller('authloginCtrl', function($modalInstance, $scope, authApi, $window, $http, $rootScope){
         $scope.login = function(){
-            authApi.login.save({username:$scope.username, password:$scope.password}, function(data){
+            authApi.login.save({email:$scope.email, password:$scope.password}, function(data){
                 $rootScope.globals.userLogged = true;
                 localStorage.setItem('token', data.token);
                 $http.defaults.headers.common.Authorization = 'Token ' + localStorage.getItem('token');
-                $modalInstance.close('/books');
+                $modalInstance.close('/');
             });
         };
         $scope.register = function () {
@@ -39,7 +39,6 @@
     .controller('authregisterCtrl', function($scope, $modalInstance, authApi){
         $scope.register = function () {
             authApi.user.save({
-                username: $scope.username,
                 email: $scope.email,
                 password: $scope.password,
             }, function(){