Commit 38b44914 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 344106: Error upgrading Bugzilla to version 2.23.2+ with perl 5.8.0 - Patch…

Bug 344106: Error upgrading Bugzilla to version 2.23.2+ with perl 5.8.0 - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked a=myk
parent 8b6eecc5
...@@ -36,8 +36,6 @@ use Bugzilla::Auth::Login::Stack; ...@@ -36,8 +36,6 @@ use Bugzilla::Auth::Login::Stack;
use Bugzilla::Auth::Verify::Stack; use Bugzilla::Auth::Verify::Stack;
use Bugzilla::Auth::Persist::Cookie; use Bugzilla::Auth::Persist::Cookie;
use Switch;
sub new { sub new {
my ($class, $params) = @_; my ($class, $params) = @_;
my $self = fields::new($class); my $self = fields::new($class);
...@@ -149,12 +147,10 @@ sub _handle_login_result { ...@@ -149,12 +147,10 @@ sub _handle_login_result {
$self->{_persister}->persist_login($user); $self->{_persister}->persist_login($user);
} }
} }
else { elsif ($fail_code == AUTH_ERROR) {
switch ($fail_code) {
case AUTH_ERROR {
ThrowCodeError($result->{error}, $result->{details}); ThrowCodeError($result->{error}, $result->{details});
} }
case AUTH_NODATA { elsif ($fail_code == AUTH_NODATA) {
if ($login_type == LOGIN_REQUIRED) { if ($login_type == LOGIN_REQUIRED) {
# This seems like as good as time as any to get rid of # This seems like as good as time as any to get rid of
# old crufty junk in the logincookies table. Get rid # old crufty junk in the logincookies table. Get rid
...@@ -167,17 +163,15 @@ sub _handle_login_result { ...@@ -167,17 +163,15 @@ sub _handle_login_result {
# Otherwise, we just return the "default" user. # Otherwise, we just return the "default" user.
$user = Bugzilla->user; $user = Bugzilla->user;
} }
# The username/password may be wrong # The username/password may be wrong
# Don't let the user know whether the username exists or whether # Don't let the user know whether the username exists or whether
# the password was just wrong. (This makes it harder for a cracker # the password was just wrong. (This makes it harder for a cracker
# to find account names by brute force) # to find account names by brute force)
case [AUTH_LOGINFAILED, AUTH_NO_SUCH_USER] { elsif (($fail_code == AUTH_LOGINFAILED) || ($fail_code == AUTH_NO_SUCH_USER)) {
ThrowUserError("invalid_username_or_password"); ThrowUserError("invalid_username_or_password");
} }
# The account may be disabled # The account may be disabled
case AUTH_DISABLED { elsif ($fail_code == AUTH_DISABLED) {
$self->{_persister}->logout(); $self->{_persister}->logout();
# XXX This is NOT a good way to do this, architecturally. # XXX This is NOT a good way to do this, architecturally.
$self->{_persister}->clear_browser_cookies(); $self->{_persister}->clear_browser_cookies();
...@@ -185,14 +179,9 @@ sub _handle_login_result { ...@@ -185,14 +179,9 @@ sub _handle_login_result {
ThrowUserError("account_disabled", ThrowUserError("account_disabled",
{'disabled_reason' => $result->{user}->disabledtext}); {'disabled_reason' => $result->{user}->disabledtext});
} }
# If we get here, then we've run out of options, which shouldn't happen.
# If we get here, then we've run out of options, which
# shouldn't happen.
else { else {
ThrowCodeError("authres_unhandled", ThrowCodeError("authres_unhandled", { value => $fail_code });
{ value => $fail_code });
}
}
} }
return $user; return $user;
......
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