Use the events to notify us that the user does not have start nodes - potetnially could emit a new event as the login screen not showing in this POC
This commit is contained in:
@@ -18,6 +18,13 @@ app.run(['$rootScope', '$route', '$location', 'urlHelper', 'navigationService',
|
||||
/** Listens for authentication and checks if our required assets are loaded, if/once they are we'll broadcast a ready event */
|
||||
eventsService.on("app.authenticated", function (evt, data) {
|
||||
|
||||
// Lets check if the auth'd user has a start node set (befor trying to make the app ready)
|
||||
const user = data.user;
|
||||
if(user.startContentIds.length === 0 && user.startMediaIds.length === 0){
|
||||
const args = { isTimedOut: true, noAccess: true };
|
||||
eventsService.emit("app.notAuthenticated", args);
|
||||
}
|
||||
|
||||
assetsService._loadInitAssets().then(function () {
|
||||
|
||||
appReady(data);
|
||||
|
||||
@@ -57,6 +57,7 @@ function MainController($scope, $location, appState, treeService, notificationsS
|
||||
};
|
||||
|
||||
$scope.showLoginScreen = function(isTimedOut) {
|
||||
console.log('SHOW ME THE LOGIN SCREEN');
|
||||
$scope.login.isTimedOut = isTimedOut;
|
||||
$scope.login.show = true;
|
||||
};
|
||||
@@ -72,6 +73,9 @@ function MainController($scope, $location, appState, treeService, notificationsS
|
||||
$scope.authenticated = null;
|
||||
$scope.user = null;
|
||||
const isTimedOut = data && data.isTimedOut ? true : false;
|
||||
|
||||
console.log('Log me out & show login screen?', isTimedOut);
|
||||
|
||||
$scope.showLoginScreen(isTimedOut);
|
||||
|
||||
// Remove the localstorage items for tours shown
|
||||
|
||||
@@ -17,6 +17,13 @@ angular.module('umbraco').controller("Umbraco.LoginController", function (events
|
||||
$location.url(path);
|
||||
});
|
||||
|
||||
eventsService.on("app.notAuthenticated", function(evt, data){
|
||||
console.log('not authenticated event back', data);
|
||||
if(data.noAccess){
|
||||
alert('NO NO NO YOU HAVE NO START NODES');
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
eventsService.unsubscribe(evtOn);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user