diff --git a/templates/index.html b/templates/index.html index e612d8e..a94ff2e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -32,11 +32,11 @@ - - - - - + + + + + diff --git a/templates/js/app.js b/templates/js/app.js index 46b8d12..9b93421 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -14,8 +14,10 @@ welcome.controller('welcomeController', ['$scope', 'apiService', '$cookies', '$w console.log("Welcome Controller"); var uid = $cookies['com.sehub.www']; - if(uid) + if(uid){ + console.info("Session in Place"); $window.location.href = DEBUG ? 'http://localhost:8080/home' : 'http://se-hub.appspot.com/home'; + } @@ -26,8 +28,7 @@ app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $routeProvider .when('/', { - templateUrl: 'templates/views/home.html', - controller: 'mainController' + templateUrl: 'templates/views/home.html' }) .when('/register', { templateUrl: 'templates/views/register.html', diff --git a/templates/js/controllers/mainController.js b/templates/js/controllers/mainController.js index c27cf90..d05f895 100644 --- a/templates/js/controllers/mainController.js +++ b/templates/js/controllers/mainController.js @@ -1,19 +1,24 @@ angular.module('SeHub') .controller('mainController', ['$scope', '$rootScope', 'apiService', '$cookies', '$location', function ($scope, $rootScope, apiService, $cookies, $location) { - $rootScope.seToken = $cookies['com.sehub.www']; - var token = $rootScope.seToken; + var token = $cookies['com.sehub.www']; + $scope.loadingData = true; + $scope.isInRegisterMode = false; apiService.getUserByToken(token).success(function(data){ - console.log(data); - if(data.message == 'No User Found') + if(data.message == 'No User Found'){ console.error("No User Found!"); + } $scope.user = data; $rootScope.user = data; - if($scope.user.isFirstLogin) + if($scope.user.isFirstLogin){ + $scope.menuObj = {}; + $scope.isInRegisterMode = true; + $scope.loadingData = false; $location.path('/register') + } }) $scope.loadingData = false; diff --git a/templates/views/index.html b/templates/views/index.html index 816e633..fcc374d 100644 --- a/templates/views/index.html +++ b/templates/views/index.html @@ -8,8 +8,8 @@ - - + +