From: dklawren Date: Fri, 26 Oct 2018 21:18:28 +0000 (-0400) Subject: Bug 1502198 - GitHubAuth cannot be removed from user_info_class indata/params if... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75dd7ce447b77ea3ba7406c5e26c3f79ced5294a;p=thirdparty%2Fbugzilla.git Bug 1502198 - GitHubAuth cannot be removed from user_info_class indata/params if extension enabled or all logins will no longer work --- diff --git a/extensions/GitHubAuth/Extension.pm b/extensions/GitHubAuth/Extension.pm index d0d9f42f1..c91bdaa31 100644 --- a/extensions/GitHubAuth/Extension.pm +++ b/extensions/GitHubAuth/Extension.pm @@ -24,14 +24,17 @@ use URI::QueryParam; our $VERSION = '0.01'; BEGIN { - # Monkey-patch can() on Bugzilla::Auth::Login::CGI so that our own fail_nodata gets called. + # Monkey-patch can() on Bugzilla::Auth::Login::CGI so that our own fail_nodata gets called + # if GitHubAuth is enabled in user_info_class. # Our fail_nodata behaves like CGI's, so this shouldn't be a problem for CGI-based logins. - *Bugzilla::Auth::Login::CGI::can = sub { my ($stack, $method) = @_; - - return undef if $method eq 'fail_nodata'; - return $stack->SUPER::can($method); + if (Bugzilla->params->{user_info_class} !~ /\bGitHubAuth\b/ + || $method ne 'fail_nodata') + { + return $stack->SUPER::can($method); + } + return undef; }; }