]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 273767: Cannot log out when Param(shutdownhtml) is active - Patch by Frédéric...
authorlpsolit%gmail.com <>
Thu, 28 Jul 2005 03:01:38 +0000 (03:01 +0000)
committerlpsolit%gmail.com <>
Thu, 28 Jul 2005 03:01:38 +0000 (03:01 +0000)
CGI.pl
template/en/default/global/messages.html.tmpl

diff --git a/CGI.pl b/CGI.pl
index e00881ade29276cae1ae8007a494f5da330ea820..190fc8de8d0c25967d29f1f5ad4d72a9d5ced854 100644 (file)
--- a/CGI.pl
+++ b/CGI.pl
@@ -67,15 +67,21 @@ require 'globals.pl';
 use vars qw($template $vars);
 
 # If Bugzilla is shut down, do not go any further, just display a message
-# to the user about the downtime.  (do)editparams.cgi is exempted from
-# this message, of course, since it needs to be available in order for
+# to the user about the downtime and log out.  (do)editparams.cgi is exempted
+# from this message, of course, since it needs to be available in order for
 # the administrator to open Bugzilla back up.
 if (Param("shutdownhtml") && $0 !~ m:(^|[\\/])(do)?editparams\.cgi$:) {
-    $::vars->{'message'} = "shutdown";
+    # For security reasons, log out users when Bugzilla is down.
+    # Bugzilla->login() is required to catch the logincookie, if any.
+    my $user = Bugzilla->login(LOGIN_OPTIONAL);
+    my $userid = $user->id;
+    Bugzilla->logout();
     
     # Return the appropriate HTTP response headers.
     print Bugzilla->cgi->header();
     
+    $::vars->{'message'} = "shutdown";
+    $::vars->{'userid'} = $userid;
     # Generate and return an HTML message about the downtime.
     $::template->process("global/message.html.tmpl", $::vars)
       || ThrowTemplateError($::template->error());
index 156bab3d89546e1b4da147119e3d4bf1affd6659..d0435597d32c48645ec111e9ef9fe6e37457a488 100644 (file)
   [% ELSIF message_tag == "shutdown" %]
     [% title = "$terms.Bugzilla is Down" %]
     [% Param("shutdownhtml") %]
+    [% IF userid %]
+      <p>For security reasons, you have been logged out automatically.
+      The cookie that was remembering your login is now gone.
+    [% END %]
 
   [% ELSIF message_tag == "user_match_failed" %]
     You entered a username that did not match any known