Commit 8a3d41fd authored by Antek Grzanka's avatar Antek Grzanka

Fixed AUTH issues, now it works flawlessly on Chrome, almost flawlessly on FF…

Fixed AUTH issues, now it works flawlessly on Chrome, almost flawlessly on FF and somehow bad on Safari. But works.
parent a78d14fc
...@@ -51,9 +51,9 @@ public class UtilResource ...@@ -51,9 +51,9 @@ public class UtilResource
{ {
String jsRedirect = "<script type=\"text/javascript\">\n" + String jsRedirect = "<script type=\"text/javascript\">\n" +
"<!--\n" + "<!--\n" +
"window.location = \"/page/#/tasks\"\n" + "window.location = \"http://\" + window.location.host + \"/page\"\n" +
"//-->\n" + "//-->\n" +
"</script>"; "</script>";
return Response.ok().entity(jsRedirect).header(HttpHeaders.CONTENT_TYPE, "text/html").build(); return Response.ok().entity(jsRedirect).header(HttpHeaders.CONTENT_TYPE, "text/html").header(HttpHeaders.WWW_AUTHENTICATE, "Basic").build();
} }
} }
...@@ -9,15 +9,13 @@ ...@@ -9,15 +9,13 @@
$scope.dataLoading = true; $scope.dataLoading = true;
AuthenticationService.login($scope.username, $scope.password, function(response) { AuthenticationService.login($scope.username, $scope.password, function(response) {
if(response.status == 200) { if(response.status == 200) {
//todo: put credentials here $('.title').html($scope.username+'@<b>capture-the-flAGH-2016</b>:~$');
$window.location.href = "http://gpietrus1:gpietrus@localhost:8080/api/v1/auth"; $location.path('/');
//todo: commeneted temporarily AuthenticationService.setCredentials($scope.username, $scope.password, response.team);
// $window.location.href = "http://gpietrus1:gpietrus@localhost:8080/api/v1/auth"; // redirect to additional external auth point
// AuthenticationService.setCredentials($scope.username, $scope.password, response.team); $window.location.href = "http://"+$scope.username+":"+$scope.password+"@localhost:8080/api/v1/auth";
// $('.title').html($scope.username+'@<b>capture-the-flAGH-2016</b>:~$');
// $location.path('/');
} else { } else {
$scope.error = response.message; Materialize.toast('Błąd logowania! Spróbuj jeszcze raz.', 5000 ,'toast-error');
$scope.dataLoading = false; $scope.dataLoading = false;
} }
}); });
......
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
$scope.user = $rootScope.globals && $rootScope.globals.currentUser ? $rootScope.globals.currentUser.username : undefined; $scope.user = $rootScope.globals && $rootScope.globals.currentUser ? $rootScope.globals.currentUser.username : undefined;
$scope.logout = function(){ $scope.logout = function(){
AuthenticationService.logout(function(data){
console.log("Logged you out... i guess...", data);
$('.title').html('guest@<b>capture-the-flAGH-2016</b>:~$'); $('.title').html('guest@<b>capture-the-flAGH-2016</b>:~$');
AuthenticationService.logout(function(data){
$location.path('/'); $location.path('/');
}); });
}; };
......
...@@ -85,10 +85,9 @@ ...@@ -85,10 +85,9 @@
$rootScope.$on('$locationChangeStart', function (event, next, current) { $rootScope.$on('$locationChangeStart', function (event, next, current) {
// redirect to login page if not logged in // redirect to login page if not logged in
console.log('Globale', $rootScope.globals); console.log('Globale', $rootScope.globals);
//todo: commented temporarily if ($location.path() !== '/login' && !$rootScope.globals.currentUser) {
// if ($location.path() !== '/login' && !$rootScope.globals.currentUser) { $location.path('/login');
// $location.path('/login'); }
// }
}); });
}]); }]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment