Bug 273767: Cannot log out when Param(shutdownhtml) is active - Patch by Fr�d�ric Buclin <LpSolit@gmail.com> r=wicked a=myk

This commit is contained in:
lpsolit%gmail.com 2005-07-27 19:58:23 +00:00
Родитель e0c14ce5c7
Коммит c1fb4a855b
2 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -54,7 +54,7 @@ use constant SHUTDOWNHTML_EXEMPT => [
##################################################################### #####################################################################
# If Bugzilla is shut down, do not allow anything to run, just display a # If Bugzilla is shut down, do not allow anything to run, just display a
# message to the user about the downtime. Scripts listed in # message to the user about the downtime and log out. Scripts listed in
# SHUTDOWNHTML_EXEMPT are exempt from this message. # SHUTDOWNHTML_EXEMPT are exempt from this message.
# #
# This code must go here. It cannot go anywhere in Bugzilla::CGI, because # This code must go here. It cannot go anywhere in Bugzilla::CGI, because
@ -62,9 +62,16 @@ use constant SHUTDOWNHTML_EXEMPT => [
if (Param("shutdownhtml") if (Param("shutdownhtml")
&& lsearch(SHUTDOWNHTML_EXEMPT, basename($0)) == -1) && lsearch(SHUTDOWNHTML_EXEMPT, basename($0)) == -1)
{ {
# 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();
my $template = Bugzilla->template; my $template = Bugzilla->template;
my $vars = {}; my $vars = {};
$vars->{'message'} = 'shutdown'; $vars->{'message'} = 'shutdown';
$vars->{'userid'} = $userid;
# Generate and return a message about the downtime, appropriately # Generate and return a message about the downtime, appropriately
# for if we're a command-line script or a CGI sript. # for if we're a command-line script or a CGI sript.
my $extension; my $extension;

Просмотреть файл

@ -236,6 +236,10 @@
[% ELSIF message_tag == "shutdown" %] [% ELSIF message_tag == "shutdown" %]
[% title = "$terms.Bugzilla is Down" %] [% title = "$terms.Bugzilla is Down" %]
[% Param("shutdownhtml") %] [% 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" %] [% ELSIF message_tag == "user_match_failed" %]
You entered a username that did not match any known You entered a username that did not match any known