Permalink
Browse files

Check the minimum length when adding or modifying users via the admin…

… screen.
  • Loading branch information...
1 parent dbf1831 commit 3b4a64c698a06a696708afb45e6c4503c2b69b13 @talmdal talmdal committed Oct 27, 2009
Showing with 4 additions and 2 deletions.
  1. +4 −1 modules/user/controllers/admin_users.php
  2. +0 −1 modules/user/controllers/users.php
View
5 modules/user/controllers/admin_users.php
@@ -311,6 +311,9 @@ static function _get_user_edit_form_admin($user) {
$group->input("url")->label(t("URL"))->id("g-url")->value($user->url);
$group->checkbox("admin")->label(t("Admin"))->id("g-admin")->checked($user->admin);
$form->add_rules_from($user);
+ $minimum_length = module::get_var("user", "mininum_password_length", 5);
+ $form->edit_user->password
+ ->rules($minimum_length ? "length[$minimum_length, 40]" : "length[40]");
module::event("user_edit_form_admin", $user, $form);
$group->submit("")->value(t("Modify User"));
@@ -334,7 +337,7 @@ static function _get_user_add_form_admin() {
$minimum_length = module::get_var("user", "mininum_password_length", 5);
$form->add_user->password
- ->rules($minimum_length ? "length[$minimum_length, 40]" : "length[40]");
+ ->rules($minimum_length ? "required|length[$minimum_length, 40]" : "length[40]");
module::event("user_add_form_admin", $user, $form);
$group->submit("")->value(t("Add User"));
View
1 modules/user/controllers/users.php
@@ -84,7 +84,6 @@ private function _get_edit_form($user) {
$form->edit_user->password
->rules($minimum_length ? "length[$minimum_length, 40]" : "length[40]");
-
module::event("user_edit_form", $user, $form);
$group->submit("")->value(t("Save"));
return $form;

0 comments on commit 3b4a64c

Please sign in to comment.