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:
parent
9a96a37681
commit
4309f8822c
@ -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();
|
||||
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user