Revision ce43137f
Von Bernd Bleßmann vor mehr als 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/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 | 49 |
|
50 | 50 |
require SL::Controller::Base; |
51 |
SL::Controller::Base->new->redirect_to('controller.pl?action=LoginScreen/user_login&error=password'); |
|
51 |
my $controller = SL::Controller::Base->new; |
|
52 |
|
|
53 |
my $callback = delete $param{callback}; |
|
54 |
if (!$callback) { |
|
55 |
delete @{ $::form }{ grep { m/^\{AUTH\}/ } keys %{ $::form } }; |
|
56 |
$callback = $controller->url_for(%param, %{$::form}); |
|
57 |
} |
|
58 |
|
|
59 |
my %redirect_params = ( |
|
60 |
controller => 'LoginScreen', |
|
61 |
action => 'user_login', |
|
62 |
error => 'password', |
|
63 |
callback => $callback, |
|
64 |
); |
|
65 |
$controller->redirect_to(%redirect_params); |
|
66 |
|
|
52 | 67 |
return 0; |
53 | 68 |
} |
54 | 69 |
|
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.