%::myconfig = $login ? $::auth->read_user(login => $login) : ();
$::locale = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode};
- my $auth_result = SL::Dispatcher::AuthHandler::User->new->handle;
+ my $auth_result = SL::Dispatcher::AuthHandler::User->new->handle(callback => $::form->{callback});
$::dispatcher->end_request unless $auth_result;
sub show_login_form {
my ($self, %params) = @_;
- $self->render('login_screen/user_login', %params, version => SL::Version->get_version );
+ $self->render('login_screen/user_login', %params, version => SL::Version->get_version, callback => $::form->{callback});
}
1;
use SL::Form;
use SL::Helper::DateTime;
use SL::InstanceConfiguration;
+use SL::MoreCommon qw(uri_encode);
use SL::Template::Plugin::HTMLFixes;
use SL::User;
if ( (($script eq 'login') && !$action)
|| ($script eq 'admin')
|| (SL::Auth::SESSION_EXPIRED() == $session_result)) {
- $self->handle_login_error(script => $script, error => 'session');
-
+ $self->handle_login_error(routing_type => $routing_type,
+ script => $script,
+ controller => $script_name,
+ action => $action,
+ error => 'session');
}
my %auth_result = $self->{auth_handler}->handle(
my $action = ($params{script} // '') =~ m/^admin/i ? 'Admin/login' : 'LoginScreen/user_login';
$action .= '&error=' . $params{error} if $params{error};
- print $::request->cgi->redirect("controller.pl?action=${action}");
+ my $redirect_url = "controller.pl?action=${action}";
+
+ if ($action =~ m/LoginScreen\/user_login/) {
+ require SL::Controller::Base;
+ my $controller = SL::Controller::Base->new;
+
+ delete $params{error};
+ delete @{ $::form }{ grep { m/^\{AUTH\}/ } keys %{ $::form } };
+ my $callback = $controller->url_for(%params, %{$::form});
+ $redirect_url .= '&callback=' . uri_encode($callback);
+ }
+
+ print $::request->cgi->redirect($redirect_url);
$self->end_request;
}
}
sub _error {
- my $self = shift;
+ my ($self, %param) = @_;
$::auth->punish_wrong_login;
- $::dispatcher->handle_login_error(error => 'password');
+ $::dispatcher->handle_login_error(%param, error => 'password');
return 0;
}