# while logged in, go ahead and clear it out.
$self->clear_anon_cache;
- return $self->generic_redirect(
- $redirect_to || $self->ctx->{home_page},
- [
+ my $cookies = [
# clear value of and expire all of these login-related cookies
$self->cgi->cookie(
-name => COOKIE_SES,
-value => '',
-expires => '-1h'
),
- # always try to delete this, even though it may not be enabled
$self->cgi->cookie(
-name => COOKIE_SHARED_SES,
-path => '/',
-value => '',
-expires => '-1h'
)
- ]
+ ];
+
+ if (defined($self->apache->dir_config('OILSWebSharedSesCookieDomain'))) {
+ my $shared_ses_domain = $self->apache->dir_config('OILSWebSharedSesCookieDomain');
+ my $shared_ses_domain_regex = '\.' . $shared_ses_domain . '$';
+
+ if ($self->apache->hostname =~ /$shared_ses_domain_regex/) {
+ push @$cookies,
+ $self->cgi->cookie(
+ -name => COOKIE_SHARED_SES,
+ -path => '/',
+ -value => '',
+ -expires => '-1h'
+ );
+ }
+ }
+
+ return $self->generic_redirect(
+ $redirect_to || $self->ctx->{home_page}, $cookies
);
}