Login dialog behavior if guest mode enabled/disabled (Fixes #1750)

This commit is contained in:
Emanuel Schuetze 2015-12-11 21:18:45 +01:00
parent 0701838bc8
commit 041b01afe5
2 changed files with 6 additions and 3 deletions

View File

@ -91,7 +91,7 @@
</div>
<!-- Login button -->
<div ng-if="!operator.isAuthenticated()">
<a href ui-sref="login" class="headerlink" uib-dropdown-toggle>
<a href ui-sref="login({guest_enabled: true})" class="headerlink" uib-dropdown-toggle>
<i class="fa fa-sign-in"></i>
<translate>Login</translate>
</a>

View File

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