diff options
-rw-r--r-- | data/global.pl | 1 | ||||
-rw-r--r-- | lib/VNDB/Util/Auth.pm | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/data/global.pl b/data/global.pl index 0d58e9b4..865a4432 100644 --- a/data/global.pl +++ b/data/global.pl @@ -19,6 +19,7 @@ our %S = (%S, url_static => 'http://s.vndb.org', skin_default => 'angel', cookie_domain => '.vndb.org', + cookie_auth => 'vndb_auth', global_salt => 'any-private-string-here', source_url => 'http://git.blicky.net/vndb.git/?h=master', admin_email => 'contact@vndb.org', diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm index 2d133476..9dd1d738 100644 --- a/lib/VNDB/Util/Auth.pm +++ b/lib/VNDB/Util/Auth.pm @@ -20,7 +20,7 @@ sub authInit { my $self = shift; $self->{_auth} = undef; - my $cookie = $self->reqCookie('vndb_auth'); + my $cookie = $self->reqCookie($self->{cookie_auth}); return 0 if !$cookie; return _rmcookie($self) if length($cookie) < 41; my $token = substr($cookie, 0, 40); @@ -47,7 +47,7 @@ sub authLogin { 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}"); + $self->resHeader('Set-Cookie', "$self->{cookie_auth}=$cookie; expires=$expstr; path=/; domain=$self->{cookie_domain}"); return 1; } @@ -59,7 +59,7 @@ sub authLogin { sub authLogout { my $self = shift; - my $cookie = $self->reqCookie('vndb_auth'); + my $cookie = $self->reqCookie($self->{cookie_auth}); if ($cookie && length($cookie) >= 41) { my $token = substr($cookie, 0, 40); my $uid = substr($cookie, 40); @@ -138,7 +138,7 @@ sub authPreparePass{ # removes the vndb_auth cookie sub _rmcookie { $_[0]->resHeader('Set-Cookie', - "vndb_auth= ; expires=Sat, 01-Jan-2000 00:00:00 GMT; path=/; domain=$_[0]->{cookie_domain}"); + "$_[0]->{cookie_auth}= ; expires=Sat, 01-Jan-2000 00:00:00 GMT; path=/; domain=$_[0]->{cookie_domain}"); } |