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 }}">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary pull-right" translate>
<button type="submit" class="btn btn-primary" translate>
Login
</button>
<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', {
template: null,
onEnter: ['$stateParams', 'ngDialog', function($stateParams, ngDialog) {
url: '/login',
params: { guest_enabled: false },
onEnter: ['$state', 'ngDialog', function($state, ngDialog) {
ngDialog.open({
template: 'static/templates/core/login-form.html',
controller: 'LoginFormCtrl',
preCloseCallback: function() {
$state.go('dashboard');
return true;
}
});
}]
});
@ -716,10 +722,11 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
.controller('LoginFormCtrl', [
'$scope',
'$http',
'$stateParams',
'operator',
'gettextCatalog',
'Config',
function ($scope, $http, operator, gettextCatalog, Config) {
function ($scope, $http, $stateParams, operator, gettextCatalog, Config) {
$scope.alerts = [];
// 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);
};
// check if guest login is allowed
$scope.guestAllowed = true; //TODO Config.get('general_system_enable_anonymous').value;
$scope.guestAllowed = $stateParams.guest_enabled;
// login
$scope.login = function () {
$http.post(