add and repair auth module (it was not detected by mercurial anymore due to a cass problem on title)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/app/auth/auth.css Fri Apr 03 10:44:34 2015 +0200
@@ -0,0 +1,9 @@
+.auth{
+ display:block;
+ margin:auto;
+}
+
+.auth input{
+ width: 300px;
+ margin: 10px 0;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/app/auth/auth_controller.js Fri Apr 03 10:44:34 2015 +0200
@@ -0,0 +1,44 @@
+(function(){
+ 'use strict';
+
+ angular.module('ammicoAuth',['ngRoute'])
+ .controller('authCtrl', function($rootScope, $routeParams, $modal){
+ $modal.open({
+ templateUrl: 'auth/' + $routeParams.action + '_modal.html',
+ controller: 'auth' + $routeParams.action + 'Ctrl'
+ });
+ })
+ .controller('authloginCtrl', function($modalInstance, $scope, authApi, $window, $http, $location, $rootScope){
+ $scope.login = function(){
+ authApi.login.save({username:$scope.username, password:$scope.password}, function(data){
+ $rootScope.globals.userLogged = true;
+ $window.sessionStorage.token = data.token;
+ $http.defaults.headers.common.Authorization = 'Token ' + $window.sessionStorage.token;
+ $modalInstance.close();
+ $location.path('/books');
+ });
+ };
+ $scope.cancel = function () {
+ $modalInstance.dismiss('cancel');
+ $location.path( '/' );
+ };
+ })
+ .controller('authlogoutCtrl', function($modalInstance, $scope, $window, $http, $location, $rootScope){
+ delete $window.sessionStorage.token;
+ $rootScope.globals.userLogged = false;
+ delete $http.defaults.headers.common.Authorization;
+
+ $scope.cancel = function () {
+ $modalInstance.close();
+ $location.path( '/' );
+ };
+ })
+ .controller('authregisterCtrl', function($scope, $modalInstance, $location){
+ $scope.register = function () {
+ };
+ $scope.back = function () {
+ $modalInstance.close();
+ $location.path( '/auth/login' );
+ };
+ });
+})();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/app/auth/auth_controller_test.js Fri Apr 03 10:44:34 2015 +0200
@@ -0,0 +1,7 @@
+'use strict';
+
+describe("auth_controller_test", function(){
+ it("should assert something",function(){
+ expect(true).toBe(true);
+ })
+})
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/app/auth/login_modal.html Fri Apr 03 10:44:34 2015 +0200
@@ -0,0 +1,15 @@
+<div class="modal-header ng-scope">
+ <h3 class="modal-title">Authentication Page</h3>
+</div>
+
+<div class="modal-body ng-scope">
+ <form ng-submit="login()">
+ <input type="text" class="form-control" ng-model='username' placeholder="Username"></input>
+ <input type="password" class="form-control" ng-model='password' placeholder="Password"></input>
+ </form>
+</div>
+
+<div class="modal-footer ng-scope">
+ <button ng-click="cancel()" class="btn btn-warning">Cancel</button>
+ <button ng-click="login()" class="btn btn-primary">Login</button>
+</div>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/app/auth/logout_modal.html Fri Apr 03 10:44:34 2015 +0200
@@ -0,0 +1,11 @@
+<div class="modal-header ng-scope">
+ <h3 class="modal-title">Deconnection</h3>
+</div>
+
+<div class="modal-body ng-scope">
+ <p>Vous n'est plus connecté</p>
+</div>
+
+<div class="modal-footer ng-scope">
+ <button ng-click="cancel()" class="btn btn-warning">Acceuil</button>
+</div>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/app/auth/register_modal.html Fri Apr 03 10:44:34 2015 +0200
@@ -0,0 +1,16 @@
+<div class="modal-header ng-scope">
+ <h3 class="modal-title">Créer un Compte</h3>
+</div>
+
+<div class="modal-body ng-scope">
+ <form ng-submit="register()">
+ <input type="text" class="form-control" ng-model='username' placeholder="Nom d'utilisateur"></input>
+ <input type="text" class="form-control" ng-model='email' placeholder="Email"></input>
+ <input type="password" class="form-control" ng-model='password' placeholder="Mot de passe"></input>
+ <input type="password" class="form-control" ng-model='password2' placeholder="Confirmer le mot de pass"></input>
+ </form>
+</div>
+
+<div class="modal-footer ng-scope">
+ <button ng-click="back()" class="btn btn-warning">Retour</button>
+</div>
\ No newline at end of file