]> 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:05:47 +0000 (03:05 +0000)
committerlpsolit%gmail.com <>
Thu, 28 Jul 2005 03:05:47 +0000 (03:05 +0000)
CGI.pl
template/en/default/global/messages.html.tmpl

diff --git a/CGI.pl b/CGI.pl
index 2af838dc210979bf2d4d9b78bd6d36f2bac65a92..862cb7a8b1a322fcb032877206ba0eaecee857d0 100644 (file)
--- a/CGI.pl
+++ b/CGI.pl
@@ -61,15 +61,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 = defined($user) ? $user->id : 0;
+    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 1685152274bb02c59fce7abe55c2d5cbcceff05b..88729286784cd7e62d1cdf42b774853205365283 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 %]
+
   [% ELSE %]
     [%# Give sensible error if error functions are used incorrectly.
       #%]