Hi, im trying to convert the vBulletin authentication plugin to an authentication plugin of my own. Im running into trouble though in the "auth_user" function.
Original:
sub auth_valid_user {
# -------------------------------------------------------------------
# Looks up the user in the user table and compares password.
#
my $args = shift;
GT::Plugins->action ( STOP ); # Make sure we don't run the main code.
# Check that user is in valid group.
if ($AUTH_CFG->{vbulletin_groups}) {
valid_group($args->{Username}) or return;
}
my $sth = $AUTH_DBH->prepare ("SELECT password FROM user WHERE username = ?");
$sth->execute ($args->{Username});
my $pass = $sth->fetchrow; # or return;
$pass or return;
return $pass eq $args->{Password};
}
I modified it to look like:
sub auth_valid_user {
my $args=shift;
my @row;
my $row;
my $sth;
GT::Plugins->action ( STOP ); # Make sure we don't run the main.
my $uusername=$args->{Username};
my $password=$args->{Password};
$sth = $AUTH_DBH->prepare ("SELECT password FROM login WHERE '$uusername'=username");
$sth->execute;
$row=$sth->fetchrow_array;
my $pass = $row;
$pass or return;
return ($pass == $password);
#
}
If the login is successfull it gives the fatal error:
Can't use string ("1") as a HASH ref while "strict refs" in use at /usr/local/apache/htdocs/links/admin/Links/User/Login.pm line 81.
I dont understand because it is returning the same variable type as the original. Also, ive seen this problem on other posts, but its with attachments and dates and stuff, never just a plain old 1.
Any ideas would be awsome!
Thanks
David
Original:
sub auth_valid_user {
# -------------------------------------------------------------------
# Looks up the user in the user table and compares password.
#
my $args = shift;
GT::Plugins->action ( STOP ); # Make sure we don't run the main code.
# Check that user is in valid group.
if ($AUTH_CFG->{vbulletin_groups}) {
valid_group($args->{Username}) or return;
}
my $sth = $AUTH_DBH->prepare ("SELECT password FROM user WHERE username = ?");
$sth->execute ($args->{Username});
my $pass = $sth->fetchrow; # or return;
$pass or return;
return $pass eq $args->{Password};
}
I modified it to look like:
sub auth_valid_user {
my $args=shift;
my @row;
my $row;
my $sth;
GT::Plugins->action ( STOP ); # Make sure we don't run the main.
my $uusername=$args->{Username};
my $password=$args->{Password};
$sth = $AUTH_DBH->prepare ("SELECT password FROM login WHERE '$uusername'=username");
$sth->execute;
$row=$sth->fetchrow_array;
my $pass = $row;
$pass or return;
return ($pass == $password);
#
}
If the login is successfull it gives the fatal error:
Can't use string ("1") as a HASH ref while "strict refs" in use at /usr/local/apache/htdocs/links/admin/Links/User/Login.pm line 81.
I dont understand because it is returning the same variable type as the original. Also, ive seen this problem on other posts, but its with attachments and dates and stuff, never just a plain old 1.
Any ideas would be awsome!
Thanks
David