From 6030d4eb6540d5c10eb1ab862d81a48420e1ec78 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 1 Feb 2010 21:13:07 -0800 Subject: Fix a bug in valid_name where it wasn't checking for name collisions on new users. --- modules/user/models/user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/user/models') diff --git a/modules/user/models/user.php b/modules/user/models/user.php index baac9315..9871ca00 100644 --- a/modules/user/models/user.php +++ b/modules/user/models/user.php @@ -122,7 +122,7 @@ class User_Model extends ORM implements User_Definition { public function valid_name(Validation $v, $field) { if (db::build()->from("users") ->where("name", "=", $this->name) - ->where("id", "<>", $this->id) + ->merge_where($this->id ? array(array("id", "<>", $this->id)) : null) ->count_records() == 1) { $v->add_error("name", "conflict"); } -- cgit v1.2.3 From b351ee48fe09efd570e22a02b82174c39ad86d46 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 2 Feb 2010 21:34:20 -0800 Subject: Fix a bug in valid_password() where an empty password was considered valid. --- modules/user/models/user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/user/models') diff --git a/modules/user/models/user.php b/modules/user/models/user.php index 9871ca00..4404ee63 100644 --- a/modules/user/models/user.php +++ b/modules/user/models/user.php @@ -136,7 +136,7 @@ class User_Model extends ORM implements User_Definition { return; } - if (!$this->loaded() || $this->password_length) { + if (!$this->loaded() || isset($this->password_length)) { $minimum_length = module::get_var("user", "mininum_password_length", 5); if ($this->password_length < $minimum_length) { $v->add_error("password", "min_length"); -- cgit v1.2.3