summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util/Auth.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-11-02 18:47:15 +0100
committerYorhel <git@yorhel.nl>2010-11-02 18:48:22 +0100
commitd6cbbc9025ccffae5ec590c692676ac944775eb0 (patch)
tree792c7cb40c02158f278148b0a46ba8ca06ce8a8b /lib/VNDB/Util/Auth.pm
parent5d44709dd98c97cb8ef9a59340990a5ecf8f62db (diff)
Prefix all cookies with a configurable cookie_prefix
This replaces the "cookie_auth" setting, and applies to all cookies in use by VNDB.
Diffstat (limited to 'lib/VNDB/Util/Auth.pm')
-rw-r--r--lib/VNDB/Util/Auth.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm
index 9dd1d738..45b39249 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($self->{cookie_auth});
+ my $cookie = $self->reqCookie($self->{cookie_prefix}.'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', "$self->{cookie_auth}=$cookie; expires=$expstr; path=/; domain=$self->{cookie_domain}");
+ $self->resHeader('Set-Cookie', "$self->{cookie_prefix}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($self->{cookie_auth});
+ my $cookie = $self->reqCookie($self->{cookie_prefix}.'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',
- "$_[0]->{cookie_auth}= ; expires=Sat, 01-Jan-2000 00:00:00 GMT; path=/; domain=$_[0]->{cookie_domain}");
+ "$_[0]->{cookie_prefix}auth= ; expires=Sat, 01-Jan-2000 00:00:00 GMT; path=/; domain=$_[0]->{cookie_domain}");
}