Merge pull request #1772 from emanuelschuetze/fix1750

Login dialog behavior if guest mode enabled/disabled (Fixes #1750)
This commit is contained in:
Oskar Hahn 2015-12-12 09:25:36 +01:00
commit d3fba3a24e
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});
}