From 4c1db37570469aef2c7cc9f2ad9f859560ca8851 Mon Sep 17 00:00:00 2001 From: "bugreport%peshkin.net" <> Date: Sat, 31 Jul 2004 09:27:23 +0000 Subject: Bug 253588: Change Bugzilla->user to be usable even for a logged-out user patch by erik,joel r=kiko a=justdave --- Bugzilla.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'Bugzilla.pm') diff --git a/Bugzilla.pm b/Bugzilla.pm index 56a8d615c..1c2a6a4b0 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -51,6 +51,11 @@ sub cgi { my $_user; sub user { my $class = shift; + + if (not defined $_user) { + $_user = new Bugzilla::User; + } + return $_user; } @@ -61,12 +66,11 @@ sub login { sub logout { my ($class, $option) = @_; - if (! $_user) { - # If we're not logged in, go away - return; - } - $option = LOGOUT_CURRENT unless defined $option; + # If we're not logged in, go away + return unless user->id; + + $option = LOGOUT_CURRENT unless defined $option; Bugzilla::Auth::Login::WWW->logout($_user, $option); } -- cgit v1.2.3-24-g4f1b