show message when user has no start nodes

This commit is contained in:
Niels Lyngsø
2020-04-15 16:43:59 +02:00
parent 0d07742671
commit 627243c84c
5 changed files with 9 additions and 15 deletions
@@ -18,8 +18,6 @@ function eventsService($q, $rootScope) {
/** raise an event with a given name */
emit: function (name, args) {
console.log(`Emitting event: ${name}`, args);
//there are no listeners
if (!$rootScope.$$listeners[name]) {
return;
+1
View File
@@ -23,6 +23,7 @@ app.run(['$rootScope', '$route', '$location', 'urlHelper', 'navigationService',
if(user.startContentIds.length === 0 && user.startMediaIds.length === 0){
const args = { isTimedOut: true, noAccess: true };
eventsService.emit("app.notAuthenticated", args);
return;
}
assetsService._loadInitAssets().then(function () {
@@ -56,9 +56,11 @@ function MainController($scope, $location, appState, treeService, notificationsS
appState.setSearchState("show", false);
};
$scope.showLoginScreen = function(isTimedOut) {
console.log('SHOW ME THE LOGIN SCREEN');
$scope.showLoginScreen = function(isTimedOut, noAccess) {
console.log('SHOW ME THE LOGIN SCREEN', isTimedOut, noAccess);
$scope.login.isTimedOut = isTimedOut;
$scope.login.noAccess = noAccess;
$scope.login.show = true;
};
@@ -73,10 +75,9 @@ function MainController($scope, $location, appState, treeService, notificationsS
$scope.authenticated = null;
$scope.user = null;
const isTimedOut = data && data.isTimedOut ? true : false;
const noAccess = data && data.noAccess ? true : false;
console.log('Log me out & show login screen?', isTimedOut);
$scope.showLoginScreen(isTimedOut);
$scope.showLoginScreen(isTimedOut, noAccess);
// Remove the localstorage items for tours shown
// Means that when next logged in they can be re-shown if not already dismissed etc
@@ -17,13 +17,6 @@ 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);
});
@@ -120,7 +120,8 @@
<div ng-show="vm.view == 'login'">
<p>
<span ng-show="vm.isTimedOut"><localize key="login_timeout">Log in below</localize>.</span>
<span ng-show="vm.isTimedOut"><localize key="login_timeout">Session timed out</localize>.</span>
<span ng-show="vm.noAccess"><localize key="login_nostartnodes">User has no start-nodes</localize>.</span>
</p>
<div class="external-logins" ng-if="vm.externalLoginProviders.length > 0">