From c67298330f4ac2944a835263ff666ba23f1c5633 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 18 Jun 2014 18:14:15 +0000 Subject: Bug 1027195 - The new BzAPI extension has broken the ability to call /rest/login to get a login token for the REST API --- extensions/BzAPI/Extension.pm | 1 + extensions/BzAPI/lib/Util.pm | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'extensions/BzAPI') diff --git a/extensions/BzAPI/Extension.pm b/extensions/BzAPI/Extension.pm index 4d144b881..0790e6596 100644 --- a/extensions/BzAPI/Extension.pm +++ b/extensions/BzAPI/Extension.pm @@ -111,6 +111,7 @@ sub webservice_fix_credentials { my ($self, $args) = @_; my $rpc = $args->{rpc}; my $params = $args->{params}; + return if !Bugzilla->request_cache->{bzapi}; fix_credentials($params); } diff --git a/extensions/BzAPI/lib/Util.pm b/extensions/BzAPI/lib/Util.pm index 6446792a0..14b083401 100644 --- a/extensions/BzAPI/lib/Util.pm +++ b/extensions/BzAPI/lib/Util.pm @@ -431,8 +431,9 @@ sub filter { sub fix_credentials { my ($params) = @_; # Allow user to pass in username=foo&password=bar to be compatible - $params->{'Bugzilla_login'} = delete $params->{'username'} if exists $params->{'username'}; - $params->{'Bugzilla_password'} = delete $params->{'password'} if exists $params->{'password'}; + $params->{'Bugzilla_login'} = $params->{'login'} = delete $params->{'username'} + if exists $params->{'username'}; + $params->{'Bugzilla_password'} = $params->{'password'} if exists $params->{'password'}; # Allow user to pass userid=1&cookie=3iYGuKZdyz for compatibility with BzAPI if (exists $params->{'userid'} && exists $params->{'cookie'}) { -- cgit v1.2.3-24-g4f1b