uodate authentication to log with email
authorrougeronj
Thu, 04 Jun 2015 20:09:20 +0200
changeset 113 b8400d8efac8
parent 112 53dc561c38d1
child 114 e4ffc4e13a8e
uodate authentication to log with email
client/app/auth/auth_controller.js
client/app/auth/login_modal.html
--- 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(){
--- a/client/app/auth/login_modal.html	Thu Jun 04 20:08:01 2015 +0200
+++ b/client/app/auth/login_modal.html	Thu Jun 04 20:09:20 2015 +0200
@@ -4,7 +4,7 @@
 
 <form ng-submit="login()">
     <div class="modal-body ng-scope">
-        <input type="text" class="form-control" ng-model='username' placeholder="Username">
+        <input type="text" class="form-control" ng-model='email' placeholder="Email">
         <input type="password" class="form-control" ng-model='password' placeholder="Password">
     </div>