Revision 540c0b5e
Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt
SL/Auth.pm | ||
---|---|---|
149 | 149 |
|
150 | 150 |
my ($self, $password) = @_; |
151 | 151 |
|
152 |
my $session_root_auth = $self->get_session_value(SESSION_KEY_ROOT_AUTH); |
|
152 |
my $session_root_auth = $self->get_session_value(SESSION_KEY_ROOT_AUTH());
|
|
153 | 153 |
if (defined $session_root_auth && $session_root_auth == OK) { |
154 | 154 |
$::lxdebug->leave_sub; |
155 | 155 |
return OK; |
... | ... | |
164 | 164 |
my $admin_password = SL::Auth::Password->hash_if_unhashed(login => 'root', password => $self->{admin_password}->()); |
165 | 165 |
|
166 | 166 |
my $result = $password eq $admin_password ? OK : ERR_PASSWORD; |
167 |
$self->set_session_value(SESSION_KEY_ROOT_AUTH ,=> $result); |
|
168 |
|
|
169 |
sleep 5 if $result != OK; |
|
167 |
$self->set_session_value(SESSION_KEY_ROOT_AUTH() => $result); |
|
170 | 168 |
|
171 | 169 |
$::lxdebug->leave_sub; |
172 | 170 |
return $result; |
... | ... | |
177 | 175 |
|
178 | 176 |
my ($self, $login, $password) = @_; |
179 | 177 |
|
180 |
my $session_auth = $self->get_session_value(SESSION_KEY_USER_AUTH); |
|
178 |
my $session_auth = $self->get_session_value(SESSION_KEY_USER_AUTH());
|
|
181 | 179 |
if (defined $session_auth && $session_auth == OK) { |
182 | 180 |
$::lxdebug->leave_sub; |
183 | 181 |
return OK; |
... | ... | |
189 | 187 |
} |
190 | 188 |
|
191 | 189 |
my $result = $login ? $self->{authenticator}->authenticate($login, $password) : ERR_USER; |
192 |
$self->set_session_value(SESSION_KEY_USER_AUTH ,=> $result, login => $login); |
|
193 |
|
|
194 |
sleep 5 if $result != OK; |
|
190 |
$self->set_session_value(SESSION_KEY_USER_AUTH() => $result, login => $login); |
|
195 | 191 |
|
196 | 192 |
$::lxdebug->leave_sub; |
197 | 193 |
return $result; |
198 | 194 |
} |
199 | 195 |
|
196 |
sub punish_wrong_login { |
|
197 |
sleep 5; |
|
198 |
} |
|
199 |
|
|
200 | 200 |
sub get_stored_password { |
201 | 201 |
my ($self, $login) = @_; |
202 | 202 |
|
Auch abrufbar als: Unified diff
User-Login auf Controller umgestellt