summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-11-15 10:46:54 +0100
committerYorhel <git@yorhel.nl>2009-11-15 10:50:19 +0100
commit7f1b892cb46c8f713a3bb7c5ea94de2f7aa42508 (patch)
treee4cf9fff72f8aefd541e52cbe47bf79284fe228f /lib/VNDB/Util
parentcd566ad416c19c81e7574491c78b81a7c609c5d2 (diff)
Auth: Combined dbSessionCheck into dbUserGet
This one query is a bit faster than the two queries executed seperately, and with a query that is executed on each pageview it does matter. Ideally, the dbUserMessageCount() is cached and fetched with the same query, this should save another 1-2ms. But this is probably not worth the extra code it would require.
Diffstat (limited to 'lib/VNDB/Util')
-rw-r--r--lib/VNDB/Util/Auth.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm
index a3bf7c29..cef9b905 100644
--- a/lib/VNDB/Util/Auth.pm
+++ b/lib/VNDB/Util/Auth.pm
@@ -25,8 +25,8 @@ sub authInit {
return _rmcookie($self) if length($cookie) < 41;
my $token = substr($cookie, 0, 40);
my $uid = substr($cookie, 40);
- return _rmcookie($self) if $uid !~ /^\d+$/ || !$self->dbSessionCheck($uid, $token);
- $self->{_auth} = $self->dbUserGet(uid => $uid, what => 'extended')->[0];
+ $self->{_auth} = $uid =~ /^\d+$/ && $self->dbUserGet(uid => $uid, session => $token, what => 'extended')->[0];
+ return _rmcookie($self) if !$self->{_auth};
}