]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 445885 รข\80\93 User.login should ThrowUserError when called with incorrect parameters
authordkl%redhat.com <>
Fri, 25 Jul 2008 02:17:04 +0000 (02:17 +0000)
committerdkl%redhat.com <>
Fri, 25 Jul 2008 02:17:04 +0000 (02:17 +0000)
Patch by David Lawrence <dkl@redhat.com> - r/a=mkanat

Bugzilla/WebService/Constants.pm
Bugzilla/WebService/User.pm

index 7a8057471bbe103b236184cb8b28baea4b9f5e34..f1a4db7c7a6e0009aef5da23fe87e8f3b2ca7ff2 100755 (executable)
@@ -50,6 +50,8 @@ use base qw(Exporter);
 # comment that it was retired. Also, if an error changes its name, you'll
 # have to fix it here.
 use constant WS_ERROR_CODE => {
+    # Generic Bugzilla::Object errors are 50-99.
+    param_required              => 50,
     # Bug errors usually occupy the 100-200 range.
     invalid_bug_id_or_alias     => 100,
     invalid_bug_id_non_existent => 101,
index 12ca0a4ce12794f4bfe1a200514e676e873606c4..8d36c3e027a3abdca831ea68987f6b6aa17b8a10 100755 (executable)
@@ -37,7 +37,13 @@ use Bugzilla::Token;
 sub login {
     my ($self, $params) = @_;
     my $remember = $params->{remember};
-    
+
+    # Username and password params are required 
+    foreach my $param ("login", "password") {
+        defined $params->{$param} 
+            || ThrowCodeError('param_required', { param => $param });
+    }
+
     # Convert $remember from a boolean 0/1 value to a CGI-compatible one.
     if (defined($remember)) {
         $remember = $remember? 'on': '';
@@ -180,6 +186,10 @@ The username does not exist, or the password is wrong.
 The account has been disabled.  A reason may be specified with the
 error.
 
+=item 50 (Param Required)
+
+A login or password parameter was not provided.
+
 =back
 
 =back