Set guest_enabled in rootScope to use it in login form after reload. (Fixes #1849)

- Justified login form elements (same width).
This commit is contained in:
Emanuel Schuetze 2016-01-21 21:13:24 +01:00
parent 42f9cfdf45
commit b291473c61
3 changed files with 9 additions and 4 deletions

View File

@ -589,6 +589,10 @@ img {
width: 250px;
}
.loginForm .input-group-addon i {
width: 15px;
}
.modal-header {
padding: 5px;
}

View File

@ -2,7 +2,7 @@
<div class="modal-header">
<img src="/static/img/openslides-logo.png" alt="OpenSlides" class="login-logo center-block">
</div>
<div class="modal-body">
<div class="modal-body loginForm">
<uib-alert ng-repeat="alert in alerts" type="{{ alert.type }}" close="closeAlert($index)">
<span ng-bind-html="alert.msg"><span>
</uib-alert>

View File

@ -149,6 +149,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);
$rootScope.guest_enabled = data.guest_enabled;
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});
@ -854,13 +855,13 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
])
.controller('LoginFormCtrl', [
'$rootScope',
'$scope',
'$http',
'$stateParams',
'operator',
'gettextCatalog',
'Config',
function ($scope, $http, $stateParams, operator, gettextCatalog, Config) {
function ($rootScope, $scope, $http, $stateParams, operator, gettextCatalog) {
$scope.alerts = [];
// get login info-text from server
@ -877,7 +878,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
$scope.alerts.splice(index, 1);
};
// check if guest login is allowed
$scope.guestAllowed = $stateParams.guest_enabled;
$scope.guestAllowed = $rootScope.guest_enabled;
// login
$scope.login = function () {
$scope.alerts = [];