Revision a4c8924a
Von Bernd Bleßmann vor fast 5 Jahren hinzugefügt
SL/Controller/LoginScreen.pm | ||
---|---|---|
58 | 58 |
|
59 | 59 |
%::myconfig = $login ? $::auth->read_user(login => $login) : (); |
60 | 60 |
$::locale = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode}; |
61 |
my $auth_result = SL::Dispatcher::AuthHandler::User->new->handle; |
|
61 |
my $auth_result = SL::Dispatcher::AuthHandler::User->new->handle(callback => $::form->{callback});
|
|
62 | 62 |
|
63 | 63 |
$::dispatcher->end_request unless $auth_result; |
64 | 64 |
|
... | ... | |
181 | 181 |
sub show_login_form { |
182 | 182 |
my ($self, %params) = @_; |
183 | 183 |
|
184 |
$self->render('login_screen/user_login', %params, version => SL::Version->get_version );
|
|
184 |
$self->render('login_screen/user_login', %params, version => SL::Version->get_version, callback => $::form->{callback});
|
|
185 | 185 |
} |
186 | 186 |
|
187 | 187 |
1; |
SL/Dispatcher.pm | ||
---|---|---|
30 | 30 |
use SL::Form; |
31 | 31 |
use SL::Helper::DateTime; |
32 | 32 |
use SL::InstanceConfiguration; |
33 |
use SL::MoreCommon qw(uri_encode); |
|
33 | 34 |
use SL::Template::Plugin::HTMLFixes; |
34 | 35 |
use SL::User; |
35 | 36 |
|
... | ... | |
291 | 292 |
if ( (($script eq 'login') && !$action) |
292 | 293 |
|| ($script eq 'admin') |
293 | 294 |
|| (SL::Auth::SESSION_EXPIRED() == $session_result)) { |
294 |
$self->handle_login_error(script => $script, error => 'session'); |
|
295 |
|
|
295 |
$self->handle_login_error(routing_type => $routing_type, |
|
296 |
script => $script, |
|
297 |
controller => $script_name, |
|
298 |
action => $action, |
|
299 |
error => 'session'); |
|
296 | 300 |
} |
297 | 301 |
|
298 | 302 |
my %auth_result = $self->{auth_handler}->handle( |
... | ... | |
393 | 397 |
my $action = ($params{script} // '') =~ m/^admin/i ? 'Admin/login' : 'LoginScreen/user_login'; |
394 | 398 |
$action .= '&error=' . $params{error} if $params{error}; |
395 | 399 |
|
396 |
print $::request->cgi->redirect("controller.pl?action=${action}"); |
|
400 |
my $redirect_url = "controller.pl?action=${action}"; |
|
401 |
|
|
402 |
if ($action =~ m/LoginScreen\/user_login/) { |
|
403 |
require SL::Controller::Base; |
|
404 |
my $controller = SL::Controller::Base->new; |
|
405 |
|
|
406 |
delete $params{error}; |
|
407 |
delete @{ $::form }{ grep { m/^\{AUTH\}/ } keys %{ $::form } }; |
|
408 |
my $callback = $controller->url_for(%params, %{$::form}); |
|
409 |
$redirect_url .= '&callback=' . uri_encode($callback); |
|
410 |
} |
|
411 |
|
|
412 |
print $::request->cgi->redirect($redirect_url); |
|
397 | 413 |
$self->end_request; |
398 | 414 |
} |
399 | 415 |
|
SL/Dispatcher/AuthHandler/User.pm | ||
---|---|---|
43 | 43 |
} |
44 | 44 |
|
45 | 45 |
sub _error { |
46 |
my $self = shift;
|
|
46 |
my ($self, %param) = @_;
|
|
47 | 47 |
|
48 | 48 |
$::auth->punish_wrong_login; |
49 |
$::dispatcher->handle_login_error(error => 'password'); |
|
49 |
$::dispatcher->handle_login_error(%param, error => 'password');
|
|
50 | 50 |
|
51 | 51 |
return 0; |
52 | 52 |
} |
templates/webpages/login_screen/user_login.html | ||
---|---|---|
24 | 24 |
<form method="post" name="loginscreen" action="controller.pl" target="_top"> |
25 | 25 |
|
26 | 26 |
<input type="hidden" name="show_dbupdate_warning" value="1"> |
27 |
[% L.hidden_tag("callback", callback) %] |
|
27 | 28 |
|
28 | 29 |
<table width="100%"> |
29 | 30 |
<tr> |
Auch abrufbar als: Unified diff
Login: Callback setzen und berücksichtigen, wenn abgemeldet
Wenn ein Ziel innerhalb des Programms aufgerufen wird (z.B. aus einem
Link, den man zugschickt bekommt) und man nicht eingeloggt ist, so
wird man zu dem Ziel weitergeleitet, nachdem man sich eingeloggt hat.