summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-05-12 11:40:56 +0200
committermkanat%bugzilla.org <>2006-05-12 11:40:56 +0200
commitd9cbb0f0a62bba345ed26ac68364bb441f41d35d (patch)
tree415d30523fb728a3192970a6d2b168b095f260dc /Bugzilla.pm
parentd7447bf95827d7e9da681d496a192fffbc2810a4 (diff)
downloadbugzilla-d9cbb0f0a62bba345ed26ac68364bb441f41d35d.tar.gz
bugzilla-d9cbb0f0a62bba345ed26ac68364bb441f41d35d.tar.xz
Bug 300410: Bugzilla::Auth needs to be restructured to not require a BEGIN block
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index eca0ebf63..b3c6ba7ce 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -26,7 +26,7 @@ package Bugzilla;
use strict;
use Bugzilla::Auth;
-use Bugzilla::Auth::Login::WWW;
+use Bugzilla::Auth::Persist::Cookie;
use Bugzilla::CGI;
use Bugzilla::Config;
use Bugzilla::Constants;
@@ -160,7 +160,13 @@ sub sudo_request {
sub login {
my ($class, $type) = @_;
- my $authenticated_user = Bugzilla::Auth::Login::WWW->login($type);
+
+ my $authorizer = new Bugzilla::Auth();
+ $type = LOGIN_REQUIRED if Bugzilla->cgi->param('GoAheadAndLogIn');
+ if (!defined $type || $type == LOGIN_NORMAL) {
+ $type = Param('requirelogin') ? LOGIN_REQUIRED : LOGIN_NORMAL;
+ }
+ my $authenticated_user = $authorizer->login($type);
# At this point, we now know if a real person is logged in.
# We must now check to see if an sudo session is in progress.
@@ -200,14 +206,15 @@ sub logout {
return unless user->id;
$option = LOGOUT_CURRENT unless defined $option;
- Bugzilla::Auth::Login::WWW->logout($_user, $option);
+ Bugzilla::Auth::Persist::Cookie->logout({type => $option});
+ Bugzilla->logout_request() unless $option eq LOGOUT_KEEP_CURRENT;
}
sub logout_user {
my ($class, $user) = @_;
# When we're logging out another user we leave cookies alone, and
# therefore avoid calling Bugzilla->logout() directly.
- Bugzilla::Auth::Login::WWW->logout($user, LOGOUT_ALL);
+ Bugzilla::Auth::Persist::Cookie->logout({user => $user});
}
# just a compatibility front-end to logout_user that gets a user by id