Revision 1c7afd9e
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Controller/LoginScreen.pm | ||
---|---|---|
30 | 30 |
return if $self->_redirect_to_main_script_if_already_logged_in; |
31 | 31 |
|
32 | 32 |
# Otherwise show the login form. |
33 |
$self->render('login_screen/user_login', error => error_state($::form->{error}));
|
|
33 |
$self->show_login_form(error => error_state($::form->{error}));
|
|
34 | 34 |
} |
35 | 35 |
|
36 | 36 |
sub action_logout { |
... | ... | |
38 | 38 |
|
39 | 39 |
$::auth->destroy_session; |
40 | 40 |
$::auth->create_or_refresh_session; |
41 |
$self->render('login_screen/user_login', error => $::locale->text('You are logged out!'));
|
|
41 |
$self->show_login_form(error => $::locale->text('You are logged out!'));
|
|
42 | 42 |
} |
43 | 43 |
|
44 | 44 |
sub action_login { |
45 | 45 |
my ($self) = @_; |
46 | 46 |
|
47 |
my $login = $::form->{'{AUTH}login'} || $::auth->get_session_value('login'); |
|
47 |
my $login = $::form->{'{AUTH}login'} || $::auth->get_session_value('login'); |
|
48 |
my $client_id = $::form->{'{AUTH}client_id'} || $::auth->get_session_value('client_id'); |
|
49 |
my $error = t8('Incorrect username or password or no access to selected client!'); |
|
50 |
|
|
51 |
if (!$::auth->set_client($client_id)) { |
|
52 |
$::auth->punish_wrong_login; |
|
53 |
return $self->show_login_form(error => $error); |
|
54 |
} |
|
55 |
|
|
48 | 56 |
%::myconfig = $login ? $::auth->read_user(login => $login) : (); |
49 | 57 |
SL::Dispatcher::AuthHandler::User->new->handle(countrycode => $::myconfig{countrycode}); |
50 | 58 |
$::form->{login} = $::myconfig{login}; |
... | ... | |
67 | 75 |
# Other login errors. |
68 | 76 |
if (0 > $result) { |
69 | 77 |
$::auth->punish_wrong_login; |
70 |
return $self->render('login_screen/user_login', error => $::locale->text('Incorrect username or password!'));
|
|
78 |
return $self->show_login_form(error => $error);
|
|
71 | 79 |
} |
72 | 80 |
|
73 | 81 |
# Everything is fine. |
74 | 82 |
$::auth->set_cookie_environment_variable(); |
75 | 83 |
|
84 |
# TODO: Employees anlegen/checken |
|
85 |
# $self->_ensure_employees_for_authorized_users_exist; |
|
86 |
|
|
76 | 87 |
$self->_redirect_to_main_script($user); |
77 | 88 |
} |
78 | 89 |
|
... | ... | |
142 | 153 |
return $default_client ? $default_client->id : undef; |
143 | 154 |
} |
144 | 155 |
|
156 |
sub show_login_form { |
|
157 |
my ($self, %params) = @_; |
|
158 |
|
|
159 |
$::request->layout->focus('#auth_login'); |
|
160 |
$self->render('login_screen/user_login', %params); |
|
161 |
} |
|
162 |
|
|
145 | 163 |
1; |
Auch abrufbar als: Unified diff
Focus & Tabreihenfolge im User-Loginscreen fixen