action => $action,
);
+ ::end_of_request() unless $auth_result{auth_ok};
+
delete @{ $::form }{ grep { m/^\{AUTH\}/ } keys %{ $::form } } unless $auth_result{keep_auth_vars};
if ($action) {
my $handler_name = "SL::Dispatcher::AuthHandler::" . ucfirst($auth_level);
$self->{handlers} ||= {};
$self->{handlers}->{$handler_name} ||= $handler_name->new;
- $self->{handlers}->{$handler_name}->handle;
+ my $ok = $self->{handlers}->{$handler_name}->handle;
return (
auth_level => $auth_level,
keep_auth_vars => $self->get_keep_auth_vars(%param),
+ auth_ok => $ok,
);
}
sub handle {
%::myconfig = ();
- return if $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'}) == $::auth->OK());
- return if !$::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::auth->get_session_value('admin_password')) == $::auth->OK());
+ return 1 if $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'}) == $::auth->OK());
+ return 1 if !$::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::auth->get_session_value('admin_password')) == $::auth->OK());
$::request->{layout} = SL::Layout::Dispatcher->new(style => 'admin');
$::auth->punish_wrong_login;
$::auth->delete_session_value('admin_password');
SL::Dispatcher::show_error('admin/adminlogin', 'password');
+
+ return 0;
}
1;
sub handle {
%::myconfig = ();
+ return 1;
}
1;
my ($self, %param) = @_;
my $login = $::form->{'{AUTH}login'} || $::auth->get_session_value('login');
- $self->_error(%param) if !defined $login;
+ return $self->_error(%param) if !defined $login;
%::myconfig = $::auth->read_user(login => $login);
- $self->_error(%param) unless $::myconfig{login};
+ return $self->_error(%param) unless $::myconfig{login};
$::locale = Locale->new($::myconfig{countrycode});
$::request->{layout} = SL::Layout::Dispatcher->new(style => $::myconfig{menustyle});
my $ok = $::form->{'{AUTH}login'} && (SL::Auth::OK() == $::auth->authenticate($::myconfig{login}, $::form->{'{AUTH}password'}));
$ok ||= !$::form->{'{AUTH}login'} && (SL::Auth::OK() == $::auth->authenticate($::myconfig{login}, undef));
- $self->_error(%param) if !$ok;
+ return $self->_error(%param) if !$ok;
$::auth->create_or_refresh_session;
$::auth->delete_session_value('FLASH');
- return %::myconfig;
+ return 1;
}
sub _error {
$::auth->punish_wrong_login;
print $::request->{cgi}->redirect('controller.pl?action=LoginScreen/user_login&error=password');
+ return 0;
}
1;