Revision 540c0b5e
Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt
SL/Dispatcher/AuthHandler/User.pm | ||
---|---|---|
5 | 5 |
use parent qw(Rose::Object); |
6 | 6 |
|
7 | 7 |
sub handle { |
8 |
my ($self, %param) = @_; |
|
9 |
|
|
8 | 10 |
my $login = $::form->{'{AUTH}login'} || $::auth->get_session_value('login'); |
9 |
SL::Dispatcher::show_error('login/password_error', 'password') if not defined $login;
|
|
11 |
$self->_error(%param) if !defined $login;
|
|
10 | 12 |
|
11 | 13 |
%::myconfig = $::auth->read_user(login => $login); |
12 | 14 |
|
13 |
SL::Dispatcher::show_error('login/password_error', 'password') unless $::myconfig{login};
|
|
15 |
$self->_error(%param) unless $::myconfig{login};
|
|
14 | 16 |
|
15 | 17 |
$::locale = Locale->new($::myconfig{countrycode}); |
16 | 18 |
|
17 |
my $ok = $::form->{'{AUTH}login'} && (SL::Auth::OK == $::auth->authenticate($login, $::form->{'{AUTH}password'}));
|
|
18 |
$ok ||= !$::form->{'{AUTH}login'} && (SL::Auth::OK == $::auth->authenticate($login, undef));
|
|
19 |
my $ok = $::form->{'{AUTH}login'} && (SL::Auth::OK() == $::auth->authenticate($::myconfig{login}, $::form->{'{AUTH}password'}));
|
|
20 |
$ok ||= !$::form->{'{AUTH}login'} && (SL::Auth::OK() == $::auth->authenticate($::myconfig{login}, undef));
|
|
19 | 21 |
|
20 |
SL::Dispatcher::show_error('login/password_error', 'password') if !$ok;
|
|
22 |
$self->_error(%param) if !$ok;
|
|
21 | 23 |
|
22 | 24 |
$::auth->create_or_refresh_session; |
23 | 25 |
$::auth->delete_session_value('FLASH'); |
26 |
|
|
27 |
return %::myconfig; |
|
28 |
} |
|
29 |
|
|
30 |
sub _error { |
|
31 |
my $self = shift; |
|
32 |
|
|
33 |
$::auth->punish_wrong_login; |
|
34 |
SL::Dispatcher::show_error('login_screen/user_login', 'password', @_); |
|
24 | 35 |
} |
25 | 36 |
|
26 | 37 |
1; |
Auch abrufbar als: Unified diff
User-Login auf Controller umgestellt