1
0

1) Insure that a group input is always part of the form, either a dropdown or hidden field

2) Create a "dummy validation function" in order to have the group and email_validation fields copied from the $_POST array.
This commit is contained in:
Tim Almdal 2010-01-14 20:16:15 -08:00
parent 9a96a37681
commit 4309f8822c
2 changed files with 11 additions and 0 deletions

View File

@ -32,6 +32,9 @@ class Admin_register_Controller extends Admin_Controller {
access::verify_csrf();
$post = new Validation($_POST);
$post->add_rules("policy", "required");
$post->add_rules("group", array($this, "passthru"));
$post->add_rules("email_verification", array($this, "passthru"));
$group_list = array();
if ($post->validate()) {
module::set_var("registration", "policy", $post->policy);
@ -49,6 +52,12 @@ class Admin_register_Controller extends Admin_Controller {
}
}
// We need this validation callback in order to have the optional fields copied to
// validation array.
public function passthru($field) {
return true;
}
public function activate() {
access::verify_csrf();

View File

@ -31,6 +31,8 @@
<? if (!empty($group_list)): ?>
<label for="group" class="g-left"> <?= t("Default group: ") ?></label>
<?= form::dropdown(array("name" => "group"), $group_list, $form["group"]) ?></label>
<? else: ?>
<?= form::hidden("group", $form["group"]) ?></label>
<? endif ?>
</li>
<li>