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:
Warren Buckley
2020-04-02 15:38:19 +01:00
parent cc62525378
commit ce3ea2328d
3 changed files with 18 additions and 0 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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);
});