no clue what im doing
This commit is contained in:
		
							parent
							
								
									0d67c0d10c
								
							
						
					
					
						commit
						20a25c38e3
					
				
							
								
								
									
										13
									
								
								js/app.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								js/app.js
									
									
									
									
									
								
							@ -8,13 +8,13 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
 | 
				
			|||||||
  $urlRouterProvider.otherwise('/splash-page');
 | 
					  $urlRouterProvider.otherwise('/splash-page');
 | 
				
			||||||
  $stateProvider
 | 
					  $stateProvider
 | 
				
			||||||
  .state('splash-page', {
 | 
					  .state('splash-page', {
 | 
				
			||||||
    data: { requiresLogin: false },
 | 
					    data: { requiresLogin: false, session: null  },
 | 
				
			||||||
    url: '/splash-page',
 | 
					    url: '/splash-page',
 | 
				
			||||||
    templateUrl: '/templates/splash-page.html',
 | 
					    templateUrl: '/templates/splash-page.html',
 | 
				
			||||||
    controller: 'loginCtrl as vm'
 | 
					    controller: 'loginCtrl as vm'
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
  .state('app',{
 | 
					  .state('app',{
 | 
				
			||||||
    data: { requiresLogin: true },
 | 
					    data: { requiresLogin: true, session: null },
 | 
				
			||||||
    url: '/',
 | 
					    url: '/',
 | 
				
			||||||
    controller: 'loginCtrl as vm',
 | 
					    controller: 'loginCtrl as vm',
 | 
				
			||||||
    views: {
 | 
					    views: {
 | 
				
			||||||
@ -112,11 +112,12 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
 | 
				
			|||||||
  });
 | 
					  });
 | 
				
			||||||
}]);
 | 
					}]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
app.run(['$rootScope', '$state', 'Auth', function($rootScope, $state, Auth) {
 | 
					app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $state, Auth, $location) {
 | 
				
			||||||
 | 
					  console.log('$location:',  $location.search());
 | 
				
			||||||
  $rootScope.urlArray = [];
 | 
					  $rootScope.urlArray = [];
 | 
				
			||||||
 | 
					 | 
				
			||||||
  $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
 | 
					  $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
 | 
				
			||||||
    var requiresLogin = toState.data.requiresLogin;
 | 
					    var requiresLogin = toState.data.requiresLogin;
 | 
				
			||||||
 | 
					    toState.data.session = $location.search();
 | 
				
			||||||
    $rootScope.redirectedURL = toState.url;
 | 
					    $rootScope.redirectedURL = toState.url;
 | 
				
			||||||
    $rootScope.urlArray.push($rootScope.redirectedURL);
 | 
					    $rootScope.urlArray.push($rootScope.redirectedURL);
 | 
				
			||||||
    if ($rootScope.urlArray.length > 1) {
 | 
					    if ($rootScope.urlArray.length > 1) {
 | 
				
			||||||
@ -126,7 +127,11 @@ app.run(['$rootScope', '$state', 'Auth', function($rootScope, $state, Auth) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (requiresLogin && !Auth.isLoggedIn()) {
 | 
					    if (requiresLogin && !Auth.isLoggedIn()) {
 | 
				
			||||||
      event.preventDefault();
 | 
					      event.preventDefault();
 | 
				
			||||||
 | 
					      console.log('asdfasdfasdfasdfasdfasdfasdfasdf', toState);
 | 
				
			||||||
      $state.go('splash-page', { 'toState': toState.name });
 | 
					      $state.go('splash-page', { 'toState': toState.name });
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      // Auth.get(Auth.session);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
}]);
 | 
					}]);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
app.controller('loginCtrl', [
 | 
					app.controller('loginCtrl', [
 | 
				
			||||||
  '$scope', '$timeout', 'Auth', '$location', 'localStorageService', '$rootScope', 'azp@oauth3.org'
 | 
					  '$scope', '$timeout', 'Auth', '$location', 'localStorageService', '$rootScope', 'azp@oauth3.org', '$stateParams'
 | 
				
			||||||
, function ($scope, $timeout, Auth, $location, localStorageService, $rootScope, Oauth3) {
 | 
					, function ($scope, $timeout, Auth, $location, localStorageService, $rootScope, Oauth3, $stateParams) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  var vm = this;
 | 
					  var vm = this;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
<section class="col-md-offset-4 col-md-4 login-container" ng-init="vm.initListLoggedInProfiles()">
 | 
					<section class="col-md-offset-4 col-md-4 login-container" ng-init="vm.initListLoggedInProfiles()">
 | 
				
			||||||
  <form>
 | 
					  <form>
 | 
				
			||||||
    <h4 class="text-center">Sign in</h4>
 | 
					    <h4 class="text-center">Sign in</h4>
 | 
				
			||||||
    <a href="#!/home" class="current-user-container" ng-repeat="profile in vm.sessions track by $index" ng-click="vm.selectSession(profile);">
 | 
					    <a ui-sref="app.home" class="current-user-container" ng-repeat="profile in vm.sessions track by $index" ng-click="vm.selectSession(profile);">
 | 
				
			||||||
      <div class="current-user-split"><i class="fa fa-user"></i></div>
 | 
					      <div class="current-user-split"><i class="fa fa-user"></i></div>
 | 
				
			||||||
      <div class="current-user-text">Resume with {{ profile.email }}</div>
 | 
					      <div class="current-user-text">Resume with {{ profile.email }}</div>
 | 
				
			||||||
    </a>
 | 
					    </a>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user