Use angular-cookirs

This commit is contained in:
manzerbredes 2016-02-17 14:01:13 +01:00
parent 8c6b1cecd3
commit 7e5db6b542
19 changed files with 119 additions and 27 deletions

View file

@ -0,0 +1 @@
loic@Manzerbredes.home.30343:1455008378

View file

@ -9,14 +9,20 @@
*/
mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$sce, Identity)
{
// Define default states
$('#loginModal').modal({backdrop: 'static', keyboard: false});
// Check for login and define default states
if(!Identity.isAlreadyLogin()){
$('#loginModal').modal({backdrop: 'static', keyboard: false});
}
$scope.$on('logoutEvent', function(){
$('#loginModal').modal({backdrop: 'static', keyboard: false});
});
$('#loadingLoginButton').hide();
$('#failedToLoginAlert').hide();
$('#loginButton').click(function(){
$scope.loginAction=function(){
// Begin login state for template
$('#loginButton').hide();
$('#loadingLoginButton').show();
@ -49,6 +55,6 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s
// Try to login
Identity.login(username, password, projectname, responseCallback);
});
};
}]);

View file

@ -6,9 +6,14 @@
* @param {$scope} $scope The $scope service from angular
* @param {Identity} The Identity service
*/
mainApp.controller('statusCtrl', ['$scope','Identity', function ($scope, Identity)
mainApp.controller('statusCtrl', ['$scope','Identity', '$rootScope', function ($scope, Identity, $rootScope)
{
$scope.profile=Identity.profile;
$scope.logout=function(){
Identity.logout();
$rootScope.$broadcast('logoutEvent');
};
}]);