]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1001462 - Bug.search causes error when using simple token auth and specifying...
authorDavid Lawrence <dkl@mozilla.com>
Mon, 12 May 2014 14:38:02 +0000 (14:38 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Mon, 12 May 2014 14:38:02 +0000 (14:38 +0000)
r/a=glob

Bugzilla/WebService/User.pm
Bugzilla/WebService/Util.pm

index b865e114c384c6d8e64b6d2995da144904710872..b73a1c7592d8990b57ec68a14fa08978f149457a 100644 (file)
@@ -55,16 +55,10 @@ sub login {
 
     # Username and password params are required 
     foreach my $param ("login", "password") {
-        defined $params->{$param} 
+        (!defined $params->{$param} && !defined $params->{'Bugzilla_' . $param})
             || ThrowCodeError('param_required', { param => $param });
     }
 
-    # Make sure the CGI user info class works if necessary.
-    my $input_params = Bugzilla->input_params;
-    $input_params->{'Bugzilla_login'} =  $params->{login};
-    $input_params->{'Bugzilla_password'} = $params->{password};
-    $input_params->{'Bugzilla_restrictlogin'} = $params->{restrict_login};
-
     my $user = Bugzilla->login();
 
     my $result = { id => $self->type('int', $user->id) };
index 195de79e44406bb795c15d43d34b9a9026d1896f..98602efc166158f2132a856ef5a1f8fdf343b419 100644 (file)
@@ -146,18 +146,16 @@ sub params_to_objects {
 
 sub fix_credentials {
     my ($params) = @_;
-    # Allow user to pass in login=foo&password=bar as a convenience
-    # even if not calling User.login. We also do not delete them as
-    # User.login requires "login" and "password".
-    if (exists $params->{'login'} && exists $params->{'password'}) {
-        $params->{'Bugzilla_login'}    = $params->{'login'};
-        $params->{'Bugzilla_password'} = $params->{'password'};
-    }
-    # Allow user to pass token=12345678 as a convenience which becomes
-    # "Bugzilla_token" which is what the auth code looks for.
-    if (exists $params->{'token'}) {
-        $params->{'Bugzilla_token'} = $params->{'token'};
-    }
+    # Allow user to pass in login, password, restrict_login, and
+    # token as short-cuts to the longer versions.
+    $params->{'Bugzilla_login'} = delete $params->{'login'}
+        if exists $params->{'login'};
+    $params->{'Bugzilla_password'} = delete $params->{'password'}
+        if exists $params->{'password'};
+    $params->{'Bugzilla_restrictlogin'} = delete $params->{'restrict_login'}
+        if exists $params->{'restrict_login'};
+    $params->{'Bugzilla_token'} = delete $params->{'token'}
+        if exists $params->{'token'};
 }
 
 __END__