diff --git a/openslides/core/static/templates/index.html b/openslides/core/static/templates/index.html
index 573f14312..bb6934f01 100644
--- a/openslides/core/static/templates/index.html
+++ b/openslides/core/static/templates/index.html
@@ -91,7 +91,7 @@
-
diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js
index e03313d8c..ee5a8009b 100644
--- a/openslides/users/static/js/users/site.js
+++ b/openslides/users/static/js/users/site.js
@@ -117,6 +117,15 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
return $http({ 'method': 'OPTIONS', 'url': '/rest/users/group/' });
}
}
+ })
+ .state('login', {
+ template: null,
+ onEnter: ['$stateParams', 'ngDialog', function($stateParams, ngDialog) {
+ ngDialog.open({
+ template: 'static/templates/core/login-form.html',
+ controller: 'LoginFormCtrl',
+ });
+ }]
});
})
@@ -124,11 +133,16 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
'operator',
'$rootScope',
'$http',
+ '$state',
'Group',
- function(operator, $rootScope, $http, Group) {
+ function(operator, $rootScope, $http, $state, Group) {
// Put the operator into the root scope
$http.get('/users/whoami/').success(function(data) {
operator.setUser(data.user_id);
+ if (data.user_id == null) {
+ // redirect to login dialog if use is not logged in
+ $state.go('login');
+ }
});
$rootScope.operator = operator;
// Load all Groups. They are needed later
@@ -696,12 +710,6 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
// DS.flush();
});
};
- $scope.openLoginForm = function () {
- ngDialog.open({
- template: 'static/templates/core/login-form.html',
- controller: 'LoginFormCtrl',
- });
- };
}
])