summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-01-26 19:46:32 +0100
committerYorhel <git@yorhel.nl>2010-01-26 19:46:32 +0100
commit38174567d7f68a2751426c0fadcda5eca1bd6861 (patch)
tree1d6832acd003ae2e0018ea47408319957dc5ef4c /lib/VNDB/Util
parent4dfb556ecc621b1983d7ad4154db202ec7530e44 (diff)
Keep track of when a session has last been used
If we're going to automatically remove older sessions, it would make more sense to remove unused sessions, rather than old sessions that are still in use. But we first need to keep track of when a session has last been used to do so...
Diffstat (limited to 'lib/VNDB/Util')
-rw-r--r--lib/VNDB/Util/Auth.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm
index 99434c3f..978b882c 100644
--- a/lib/VNDB/Util/Auth.pm
+++ b/lib/VNDB/Util/Auth.pm
@@ -26,6 +26,8 @@ sub authInit {
my $token = substr($cookie, 0, 40);
my $uid = substr($cookie, 40);
$self->{_auth} = $uid =~ /^\d+$/ && $self->dbUserGet(uid => $uid, session => $token, what => 'extended notifycount')->[0];
+ # update the sessions.lastused column if lastused < now()'6 hours'
+ $self->dbSessionUpdateLastUsed($uid, $token) if $self->{_auth} && $self->{_auth}{session_lastused} < time()-6*3600;
return _rmcookie($self) if !$self->{_auth};
}