From f82550b1cef9e91780b43e61c60c61af1ba139fd Mon Sep 17 00:00:00 2001 From: Yorhel Date: Tue, 26 Jan 2010 19:51:30 +0100 Subject: SQL: Replaced sessions.expiration with sessions.added An expiration date doesn't make much sense if it's both not used and if it can't be configured by the user, so just make this a timestamp to indicate when the session has been added, which, while still not really used, is more valuable. --- lib/VNDB/Util/Auth.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/VNDB/Util/Auth.pm') diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm index 978b882c..2d133476 100644 --- a/lib/VNDB/Util/Auth.pm +++ b/lib/VNDB/Util/Auth.pm @@ -42,11 +42,10 @@ sub authLogin { if(_authCheck($self, $user, $pass)) { 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, $expiration); + $self->dbSessionAdd($self->{_auth}{id}, $token); - my $expstr = strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime($expiration)); + my $expstr = strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime(time + 31536000)); # keep the cookie for 1 year $self->resRedirect($to, 'post'); $self->resHeader('Set-Cookie', "vndb_auth=$cookie; expires=$expstr; path=/; domain=$self->{cookie_domain}"); return 1; -- cgit v1.2.3