From 041b01afe5567f98ac67eb712cb74b0f542996bd Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Fri, 11 Dec 2015 21:18:45 +0100 Subject: [PATCH] Login dialog behavior if guest mode enabled/disabled (Fixes #1750) --- openslides/core/static/templates/index.html | 2 +- openslides/users/static/js/users/site.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openslides/core/static/templates/index.html b/openslides/core/static/templates/index.html index bcb471bb3..772719514 100644 --- a/openslides/core/static/templates/index.html +++ b/openslides/core/static/templates/index.html @@ -91,7 +91,7 @@
- + Login diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 01d41d968..397b10ca3 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -122,10 +122,13 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) template: null, url: '/login', params: { guest_enabled: false }, - onEnter: ['$state', 'ngDialog', function($state, ngDialog) { + onEnter: ['$state', '$stateParams', 'ngDialog', function($state, $stateParams, ngDialog) { ngDialog.open({ template: 'static/templates/core/login-form.html', controller: 'LoginFormCtrl', + showClose: $stateParams.guest_enabled, + closeByEscape: $stateParams.guest_enabled, + closeByDocument: $stateParams.guest_enabled, preCloseCallback: function() { $state.go('dashboard'); return true; @@ -145,7 +148,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) // Put the operator into the root scope $http.get('/users/whoami/').success(function(data) { operator.setUser(data.user_id); - if (data.user_id === null) { + if (data.user_id === null && !data.guest_enabled) { // redirect to login dialog if use is not logged in $state.go('login', {guest_enabled: data.guest_enabled}); }