diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-01-01 02:24:01 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-01-01 02:24:01 +0000 |
commit | b8af0a52b1e403fefb5675ae420733304284da5d (patch) | |
tree | c85fa6c8a62590520ef44971fcb5ceeb3bbde6b5 | |
parent | e3a44b04c90097e587f9e127e9c8440db405ce22 (diff) | |
download | elgg-b8af0a52b1e403fefb5675ae420733304284da5d.tar.gz elgg-b8af0a52b1e403fefb5675ae420733304284da5d.tar.bz2 |
Fixes #2740 - exception messages using the value for minimum username and password length
git-svn-id: http://code.elgg.org/elgg/trunk@7800 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/users.php | 10 | ||||
-rw-r--r-- | languages/en.php | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php index 04e1eeff4..dcdad3193 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1026,7 +1026,8 @@ function validate_username($username) { } if (strlen($username) < $CONFIG->minusername) { - throw new RegistrationException(elgg_echo('registration:usernametooshort')); + $msg = elgg_echo('registration:usernametooshort', array($CONFIG->minusername)); + throw new RegistrationException($msg); } // Blacklist for bad characters (partially nicked from mediawiki) @@ -1072,8 +1073,13 @@ function validate_username($username) { function validate_password($password) { global $CONFIG; + if (!isset($CONFIG->min_password_length)) { + $CONFIG->min_password_length = 6; + } + if (strlen($password) < $CONFIG->min_password_length) { - throw new RegistrationException(elgg_echo('registration:passwordtooshort')); + $msg = elgg_echo('registration:passwordtooshort', array($CONFIG->min_password_length)); + throw new RegistrationException($msg); } $result = true; diff --git a/languages/en.php b/languages/en.php index 94bf38c2a..42776cb3f 100644 --- a/languages/en.php +++ b/languages/en.php @@ -484,8 +484,8 @@ $english = array( 'registration:notemail' => 'The email address you provided does not appear to be a valid email address.', 'registration:userexists' => 'That username already exists', - 'registration:usernametooshort' => 'Your username must be a minimum of 4 characters long.', - 'registration:passwordtooshort' => 'The password must be a minimum of 6 characters long.', + 'registration:usernametooshort' => 'Your username must be a minimum of %u characters long.', + 'registration:passwordtooshort' => 'The password must be a minimum of %u characters long.', 'registration:dupeemail' => 'This email address has already been registered.', 'registration:invalidchars' => 'Sorry, your username contains the following invalid character: %s. All of these characters are invalid: %s', 'registration:emailnotvalid' => 'Sorry, the email address you entered is invalid on this system', |