summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
author3dB <3db@3decibels.net>2009-07-28 21:36:53 -0400
committer3dB <3db@3decibels.net>2009-07-28 21:36:53 -0400
commit24c4392ce66d088e6933686395296c1419de22b5 (patch)
tree4a5c5f0c268cc57acada2fc63226c196c55b043d /lib
parent515ea4144ae671c2d6e1a6073295bf56cc208a23 (diff)
Rewrote cookie experation string generation to use POSIX::strftime
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Util/Auth.pm8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm
index b8af3130..ad7659a9 100644
--- a/lib/VNDB/Util/Auth.pm
+++ b/lib/VNDB/Util/Auth.pm
@@ -8,6 +8,7 @@ use Exporter 'import';
use Digest::MD5 'md5';
use Digest::SHA qw|sha1_hex sha256 sha256_hex|;
use Time::HiRes;
+use POSIX 'strftime';
our @EXPORT = qw| authInit authLogin authLogout authInfo authCan authPreparePass |;
@@ -42,13 +43,10 @@ sub authLogin {
$self->dbSessionAdd($self->{_auth}{id}, $token, $expiration);
my @time = gmtime($expiration);
- $time[5] += 1900;
- my @days = qw|Sun Mon Tues Wed Thurs Fri Sat|;
- my @months = qw|Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec|;
- my $expString = "$days[$time[6]], $time[3]-$months[$time[4]]-$time[5] 00:00:00 GMT";
+ my $expstr = strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime($expiration));
$self->resRedirect($to, 'post');
- $self->resHeader('Set-Cookie', "vndb_auth=$cookie; expires=$expString; path=/; domain=$self->{cookie_domain}");
+ $self->resHeader('Set-Cookie', "vndb_auth=$cookie; expires=$expstr; path=/; domain=$self->{cookie_domain}");
return 1;
}