<%once> use HTML::Entities; # For encode_entities() use Masterkey::Admin; use Apache2::Cookie; <%perl> my $tmpAdmin = new Masterkey::Admin(undef); my $tab = $tmpAdmin->siteConfigValue("redirectToTab"); if (defined $tab) { # Site is defined with no separate login page, just a home tab return $m->comp("/mc/layout.mc", %ARGS, title => "Logout", component => "/mc/logout.mc"); } else { $m->comp("/mc/setup.mc"); my $session = $m->notes("session"); $session->update(user_id => 0); # Remove cookies from all authentication domains my %cookies = Apache2::Cookie->fetch($r); foreach my $key (sort keys %cookies) { if ($key =~ /^session-/) { my $cookie = new Apache2::Cookie($r, -path => "/", -name => $key, -value => "", -expires => "0"); $cookie->bake($r); } } # Remove back-door cookie, if it is configured (it shouldn't be!) my $cname = $m->notes("admin")->configValue("authUserCookie"); if (defined $cname) { my $cookie = new Apache2::Cookie($r, -path => "/", -name => $cname, -value => "", -expires => "0"); $cookie->bake($r); } my $uri = $ENV{REQUEST_URI}; $m->comp("/mc/redirect.html", url => ($uri =~ /^\/console\// ? "/console/" : "/")); }