3 use SL::Auth::Constants qw(:all);
9 $main::lxdebug->enter_sub();
14 $self->{auth} = shift;
18 $main::lxdebug->leave_sub();
24 $main::lxdebug->enter_sub();
29 my $is_crypted = shift;
31 my $dbh = $self->{auth}->dbconnect();
34 $main::lxdebug->leave_sub();
38 my $query = qq|SELECT password FROM auth."user" WHERE login = ?|;
39 my ($stored_password) = $dbh->selectrow_array($query, undef, $login);
41 $password = crypt $password, substr($login, 0, 2) if (!$password || !$is_crypted);
42 $stored_password = crypt $stored_password, substr($login, 0, 2) if (!$stored_password);
44 $main::lxdebug->leave_sub();
46 return $password eq $stored_password ? OK : ERR_PASSWORD;
49 sub can_change_password {
54 $main::lxdebug->enter_sub();
59 my $is_crypted = shift;
61 my $dbh = $self->{auth}->dbconnect();
64 $main::lxdebug->leave_sub();
68 $password = crypt $password, substr($login, 0, 2) if (!$is_crypted);
70 do_query($main::form, $dbh, qq|UPDATE auth."user" SET password = ? WHERE login = ?|, $password, $login);
74 $main::lxdebug->leave_sub();