summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util/Auth.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-08-08 16:09:47 +0200
committerYorhel <git@yorhel.nl>2009-08-08 16:09:47 +0200
commit5865bdbb0c0b9492d57af220bb00ee9d1f7eeed7 (patch)
tree81534ac58b0461d455d140c2709b0c517d06afbe /lib/VNDB/Util/Auth.pm
parent7c50eca82694cd1da0c77711be698d4f258289f4 (diff)
Improved handling of the timestamp columns in anime and session tables
Anything fetched from the DB to Perl should be converted to a UNIX timestamp, and everything that goes from Perl to the DB should be converted from a UNIX timestamp to a timestamptz data type. Also, when creating a session, don't rely on the fact that the expiration default happens to be the same as the cookie expiration time calculated in Perl. It's cleaner to calculate the date at one place and then use that everywhere else.
Diffstat (limited to 'lib/VNDB/Util/Auth.pm')
-rw-r--r--lib/VNDB/Util/Auth.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm
index b9724964..ad225d92 100644
--- a/lib/VNDB/Util/Auth.pm
+++ b/lib/VNDB/Util/Auth.pm
@@ -42,7 +42,7 @@ sub authLogin {
my $token = sha1_hex(join('', Time::HiRes::gettimeofday()) . join('', map chr(rand(93)+33), 1..9));
my $expiration = time + 31536000; # 1yr
my $cookie = $token . $self->{_auth}{id};
- $self->dbSessionAdd($self->{_auth}{id}, $token);
+ $self->dbSessionAdd($self->{_auth}{id}, $token, $expiration);
my $expstr = strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime($expiration));
$self->resRedirect($to, 'post');