From: Moritz Bunkus Date: Wed, 12 Jun 2013 12:22:43 +0000 (+0200) Subject: Focus & Tabreihenfolge im User-Loginscreen fixen X-Git-Tag: release-3.1.0beta1~331^2~35 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1c7afd9ee2b5d6233302774c6a69a154a3de29fa;p=kivitendo-erp.git Focus & Tabreihenfolge im User-Loginscreen fixen --- diff --git a/SL/Controller/LoginScreen.pm b/SL/Controller/LoginScreen.pm index 6c31a9055..c32d0a3b6 100644 --- a/SL/Controller/LoginScreen.pm +++ b/SL/Controller/LoginScreen.pm @@ -30,7 +30,7 @@ sub action_user_login { return if $self->_redirect_to_main_script_if_already_logged_in; # Otherwise show the login form. - $self->render('login_screen/user_login', error => error_state($::form->{error})); + $self->show_login_form(error => error_state($::form->{error})); } sub action_logout { @@ -38,13 +38,21 @@ sub action_logout { $::auth->destroy_session; $::auth->create_or_refresh_session; - $self->render('login_screen/user_login', error => $::locale->text('You are logged out!')); + $self->show_login_form(error => $::locale->text('You are logged out!')); } sub action_login { my ($self) = @_; - my $login = $::form->{'{AUTH}login'} || $::auth->get_session_value('login'); + my $login = $::form->{'{AUTH}login'} || $::auth->get_session_value('login'); + my $client_id = $::form->{'{AUTH}client_id'} || $::auth->get_session_value('client_id'); + my $error = t8('Incorrect username or password or no access to selected client!'); + + if (!$::auth->set_client($client_id)) { + $::auth->punish_wrong_login; + return $self->show_login_form(error => $error); + } + %::myconfig = $login ? $::auth->read_user(login => $login) : (); SL::Dispatcher::AuthHandler::User->new->handle(countrycode => $::myconfig{countrycode}); $::form->{login} = $::myconfig{login}; @@ -67,12 +75,15 @@ sub action_login { # Other login errors. if (0 > $result) { $::auth->punish_wrong_login; - return $self->render('login_screen/user_login', error => $::locale->text('Incorrect username or password!')); + return $self->show_login_form(error => $error); } # Everything is fine. $::auth->set_cookie_environment_variable(); + # TODO: Employees anlegen/checken + # $self->_ensure_employees_for_authorized_users_exist; + $self->_redirect_to_main_script($user); } @@ -142,4 +153,11 @@ sub init_default_client_id { return $default_client ? $default_client->id : undef; } +sub show_login_form { + my ($self, %params) = @_; + + $::request->layout->focus('#auth_login'); + $self->render('login_screen/user_login', %params); +} + 1; diff --git a/templates/webpages/login_screen/user_login.html b/templates/webpages/login_screen/user_login.html index 453b07e70..0a161ec09 100644 --- a/templates/webpages/login_screen/user_login.html +++ b/templates/webpages/login_screen/user_login.html @@ -23,7 +23,7 @@ - + @@ -37,7 +37,7 @@
- + @@ -58,6 +58,3 @@
[% 'Login Name' | $T8 %][% L.input_tag('{AUTH}login', '', style=style) %][% L.input_tag('{AUTH}login', '', id='auth_login', style=style) %]
[% 'Password' | $T8 %]
-