11 $main::lxdebug->enter_sub();
16 $self->{auth} = shift;
20 $main::lxdebug->leave_sub();
26 $main::lxdebug->enter_sub();
31 my $is_crypted = shift;
33 my $dbh = $self->{auth}->dbconnect();
36 $main::lxdebug->leave_sub();
37 return SL::Auth->ERR_BACKEND();
40 my $query = qq|SELECT password FROM auth."user" WHERE login = ?|;
41 my ($stored_password) = $dbh->selectrow_array($query, undef, $login);
43 $password = crypt $password, substr($login, 0, 2) if (!$password || !$is_crypted);
44 $stored_password = crypt $stored_password, substr($login, 0, 2) if (!$stored_password);
46 $main::lxdebug->leave_sub();
48 return $password eq $stored_password ? SL::Auth->OK() : SL::Auth->ERR_PASSWORD();
51 sub can_change_password {
56 $main::lxdebug->enter_sub();
61 my $is_crypted = shift;
63 my $dbh = $self->{auth}->dbconnect();
66 $main::lxdebug->leave_sub();
67 return SL::Auth->ERR_BACKEND()
70 $password = crypt $password, substr($login, 0, 2) if (!$is_crypted);
72 do_query($main::form, $dbh, qq|UPDATE auth."user" SET password = ? WHERE login = ?|, $password, $login);
76 $main::lxdebug->leave_sub();