Commit 1929d7a0 authored by dkl%redhat.com's avatar dkl%redhat.com

Bug 445885 – User.login should ThrowUserError when called with incorrect parameters

Patch by David Lawrence <dkl@redhat.com> - a/r=mkanat
parent c71b9d01
...@@ -44,6 +44,12 @@ sub login { ...@@ -44,6 +44,12 @@ sub login {
my ($self, $params) = @_; my ($self, $params) = @_;
my $remember = $params->{remember}; 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. # Convert $remember from a boolean 0/1 value to a CGI-compatible one.
if (defined($remember)) { if (defined($remember)) {
$remember = $remember? 'on': ''; $remember = $remember? 'on': '';
...@@ -287,6 +293,10 @@ The username does not exist, or the password is wrong. ...@@ -287,6 +293,10 @@ The username does not exist, or the password is wrong.
The account has been disabled. A reason may be specified with the The account has been disabled. A reason may be specified with the
error. error.
=item 50 (Param Required)
A login or password parameter was not provided.
=back =back
=back =back
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment