From: Frédéric Buclin
Date: Thu, 14 Oct 2010 00:43:05 +0000 (+0200)
Subject: Bug 575947: Users with passwords length less than 6 characters can't login after...
X-Git-Tag: bugzilla-3.6.3~14
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=992a2377eec51afd906663b0fa458db40933e727;p=thirdparty%2Fbugzilla.git
Bug 575947: Users with passwords length less than 6 characters can't login after migration from 3.4.x or older to 3.6 or newer
r/a=mkanat
---
diff --git a/Bugzilla/Auth.pm b/Bugzilla/Auth.pm
index b1da319a4c..f289a4ba11 100644
--- a/Bugzilla/Auth.pm
+++ b/Bugzilla/Auth.pm
@@ -151,7 +151,12 @@ sub _handle_login_result {
}
}
elsif ($fail_code == AUTH_ERROR) {
- ThrowCodeError($result->{error}, $result->{details});
+ if ($result->{user_error}) {
+ ThrowUserError($result->{error}, $result->{details});
+ }
+ else {
+ ThrowCodeError($result->{error}, $result->{details});
+ }
}
elsif ($fail_code == AUTH_NODATA) {
$self->{_info_getter}->fail_nodata($self)
diff --git a/Bugzilla/Auth/Verify/DB.pm b/Bugzilla/Auth/Verify/DB.pm
index d8794472ef..c562d13536 100644
--- a/Bugzilla/Auth/Verify/DB.pm
+++ b/Bugzilla/Auth/Verify/DB.pm
@@ -74,6 +74,12 @@ sub check_credentials {
};
}
+ # Force the user to type a longer password if it's too short.
+ if (length($password) < USER_PASSWORD_MIN_LENGTH) {
+ return { failure => AUTH_ERROR, error => 'password_current_too_short',
+ user_error => 1, details => { locked_user => $user } };
+ }
+
# The user's credentials are okay, so delete any outstanding
# password tokens or login failures they may have generated.
Bugzilla::Token::DeletePasswordTokens($user->id, "user_logged_in");
diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm
index 19d2307590..f31620dfb7 100644
--- a/Bugzilla/WebService/Constants.pm
+++ b/Bugzilla/WebService/Constants.pm
@@ -102,6 +102,7 @@ use constant WS_ERROR_CODE => {
auth_invalid_email => 302,
extern_id_conflict => -303,
auth_failure => 304,
+ password_current_too_short => 305,
# Except, historically, AUTH_NODATA, which is 410.
login_required => 410,
diff --git a/Bugzilla/WebService/User.pm b/Bugzilla/WebService/User.pm
index 76d4d3e376..caa02c4fac 100644
--- a/Bugzilla/WebService/User.pm
+++ b/Bugzilla/WebService/User.pm
@@ -295,6 +295,11 @@ The username does not exist, or the password is wrong.
The account has been disabled. A reason may be specified with the
error.
+=item 305 (New Password Required)
+
+The current password is correct, but the user is asked to change
+his password.
+
=item 50 (Param Required)
A login or password parameter was not provided.
diff --git a/template/en/default/account/email/confirm-new.html.tmpl b/template/en/default/account/email/confirm-new.html.tmpl
index ed0ff34052..36bd52d090 100644
--- a/template/en/default/account/email/confirm-new.html.tmpl
+++ b/template/en/default/account/email/confirm-new.html.tmpl
@@ -24,11 +24,11 @@
title = title
onload = "document.forms['confirm_account_form'].realname.focus();" %]
-
+
To create your account, you must enter a password in the form below.
Your email address and Real Name (if provided) will be shown with
changes you make.
-
+