]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 575947: Users with passwords length less than 6 characters can't login after...
authorFrédéric Buclin <LpSolit@gmail.com>
Thu, 14 Oct 2010 00:43:05 +0000 (02:43 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 14 Oct 2010 00:43:05 +0000 (02:43 +0200)
r/a=mkanat

Bugzilla/Auth.pm
Bugzilla/Auth/Verify/DB.pm
Bugzilla/WebService/Constants.pm
Bugzilla/WebService/User.pm
template/en/default/account/email/confirm-new.html.tmpl
template/en/default/account/password/set-forgotten-password.html.tmpl
template/en/default/global/user-error.html.tmpl

index b1da319a4cd910d649554ef391987fc93c75b1a1..f289a4ba11431bf195f86cab294df1691b5ebb2e 100644 (file)
@@ -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) 
index d8794472ef6f41755bd9e2564cf747f9d5b569e0..c562d13536820758596b4df55a5d34b295bc25ab 100644 (file)
@@ -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");
index 19d2307590572fbb6c76157194917bbae0b86b57..f31620dfb75f34047d69c8ed511bf4f015b05726 100644 (file)
@@ -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,
index 76d4d3e376b5478a13a349c4fdd98b8f9f75fef2..caa02c4fac4e2b280a0a9cbafcfdffd4027ead5e 100644 (file)
@@ -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.
index ed0ff34052d5ab0bcbfda74c5b7aabdfeb97e886..36bd52d090fe104df10cdc0833e232f3f825d219 100644 (file)
            title = title
            onload = "document.forms['confirm_account_form'].realname.focus();" %]
 
-<div>
+<p>
   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.
-</div>
+</p>
 
 <form id="confirm_account_form" method="post" action="token.cgi">
   <input type="hidden" name="t" value="[% token FILTER html %]">
     </tr>
     <tr>
       <th align="right"><label for="passwd1">Type your password</label>:</th>
-      <td><input type="password" id="passwd1" name="passwd1" value=""></td>
+      <td>
+        <input type="password" id="passwd1" name="passwd1" value="">
+        (minimum [% constants.USER_PASSWORD_MIN_LENGTH FILTER none %] characters)
+      </td>
     </tr>
     <tr>
       <th align="right"><label for="passwd2">Confirm your password</label>:</th>
index ca134a4866b25d9b4b99f84a30a6ef5a7f45fa74..a2ae517c83dca39378b6196ab42ab340a90103c6 100644 (file)
@@ -33,6 +33,7 @@
       <th align="right">New Password:</th>
       <td>
         <input type="password" name="password">
+        (minimum [% constants.USER_PASSWORD_MIN_LENGTH FILTER none %] characters)
       </td>
     </tr>
     
index 6f86a5cba879cfc1b8aaf1c9a5864491e1d2c736..49589e410a20660bd33dc9d9a91debcc44a364d4 100644 (file)
     [% title = "Passwords Don't Match" %]
     The two passwords you entered did not match.
 
+  [% ELSIF error == "password_current_too_short" %]
+    [% title = "New Password Required" %]
+    Your password is currently less than
+    [%+ constants.USER_PASSWORD_MIN_LENGTH FILTER html %] characters long,
+    which is the new minimum length required for passwords.
+    You must <a href="token.cgi?a=reqpw&loginname=[% locked_user.email FILTER html %]">
+    request a new password</a> in order to log in again.
+
   [% ELSIF error == "password_too_short" %]
     [% title = "Password Too Short" %]
     The password must be at least