Apache2-AuthAny
view release on metacpan or search on metacpan
lib/Apache2/AuthAny/DB.pm view on Meta::CPAN
$self->useDB();
if ( $dbHandle->do($sql, undef, @passed_values) ) {
my $UID = $dbHandle->last_insert_id(undef, undef, undef, undef);
return $UID;
} else {
warn $dbHandle->errstr;
return undef;
}
}
sub updateUser {
my $self = shift;
my %user = @_;
my $existingUser = $self->getUserByUsername($user{username}) || {};
my $UID = $existingUser->{UID};
unless ($UID) {
warn "User, '$user{username}' does not exists\n";
return;
}
lib/Apache2/AuthAny/DB.pm view on Meta::CPAN
$self->useDB();
if ($dbHandle->do($sql, undef, $pCookie, $sCookie, $logout_key, time)) {
return 1;
} else {
warn $dbHandle->errstr;
return 0;
}
}
sub updatePCookieLastAccess {
my $self = shift;
my ($pCookie) = @_;
unless ($pCookie) {
warn "Missing pid";
return 0;
}
my $sql = "UPDATE userAACookie
SET last = ?
lib/Apache2/AuthAny/DB.pm view on Meta::CPAN
$self->useDB();
if ($dbHandle->do($sql, undef, time, $pCookie) eq 1) {
return 1;
} else {
warn "Could not update DB with PID, '$pCookie'" . $dbHandle->errstr;
return 0;
}
}
sub updatePCookieLogoutKey {
my $self = shift;
my ($pCookie) = @_;
unless ($pCookie) {
warn "Missing pid";
return 0;
}
my $sql = "UPDATE userAACookie
SET logoutKey = ?
WHERE pid = ?";
lib/Apache2/AuthAny/FixupHandler.pm view on Meta::CPAN
# not already timed out
my $pid = $r->pnotes('pid');
$aaDB = Apache2::AuthAny::DB->new() unless $aaDB;
$aaDB->updatePCookieLastAccess($pid->{PID}) || warn "Could not update last access";
}
return Apache2::Const::DECLINED;
}
###!!!! MOVE THIS TO Cookie.pm
# called after basic login
sub update_logout_key {
my $r = shift;
my $pid = $r->pnotes('pid');
$aaDB = Apache2::AuthAny::DB->new() unless $aaDB;
$aaDB->updatePCookieLogoutKey($pid->{PID}) || warn "Could not update last access";
return Apache2::Const::DECLINED;
}
1;
( run in 0.245 second using v1.01-cache-2.11-cpan-95122f20152 )