Improved login form.

- Add redirect after aborting login. (Fixes #1762)
- Use new state paramater 'guest_enabled' for login form.
This commit is contained in:
Emanuel Schuetze 2015-12-10 08:35:56 +01:00
parent 24cb58dc12
commit 5d29af5f52
2 changed files with 11 additions and 4 deletions

View File

@ -17,7 +17,7 @@
placeholder="{{ 'Password' | translate }}"> placeholder="{{ 'Password' | translate }}">
</div> </div>
<div class="form-group"> <div class="form-group">
<button type="submit" class="btn btn-primary pull-right" translate> <button type="submit" class="btn btn-primary" translate>
Login Login
</button> </button>
<button ng-if="guestAllowed" ng-click="guestLogin()" class="btn btn-default" translate> <button ng-if="guestAllowed" ng-click="guestLogin()" class="btn btn-default" translate>

View File

@ -120,10 +120,16 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
}) })
.state('login', { .state('login', {
template: null, template: null,
onEnter: ['$stateParams', 'ngDialog', function($stateParams, ngDialog) { url: '/login',
params: { guest_enabled: false },
onEnter: ['$state', 'ngDialog', function($state, ngDialog) {
ngDialog.open({ ngDialog.open({
template: 'static/templates/core/login-form.html', template: 'static/templates/core/login-form.html',
controller: 'LoginFormCtrl', controller: 'LoginFormCtrl',
preCloseCallback: function() {
$state.go('dashboard');
return true;
}
}); });
}] }]
}); });
@ -716,10 +722,11 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
.controller('LoginFormCtrl', [ .controller('LoginFormCtrl', [
'$scope', '$scope',
'$http', '$http',
'$stateParams',
'operator', 'operator',
'gettextCatalog', 'gettextCatalog',
'Config', 'Config',
function ($scope, $http, operator, gettextCatalog, Config) { function ($scope, $http, $stateParams, operator, gettextCatalog, Config) {
$scope.alerts = []; $scope.alerts = [];
// TODO: add welcome message only on first time (or if admin password not changed) // TODO: add welcome message only on first time (or if admin password not changed)
@ -734,7 +741,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
$scope.alerts.splice(index, 1); $scope.alerts.splice(index, 1);
}; };
// check if guest login is allowed // check if guest login is allowed
$scope.guestAllowed = true; //TODO Config.get('general_system_enable_anonymous').value; $scope.guestAllowed = $stateParams.guest_enabled;
// login // login
$scope.login = function () { $scope.login = function () {
$http.post( $http.post(