From a6d58665c6567e9efc241c971d03fff3417dc354 Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Wed, 30 Dec 2015 11:41:56 -0500 Subject: Add password confirmation and change to Form_* framework --- src/usr/local/www/vpn_l2tp_users_edit.php | 98 ++++++++++++++----------------- 1 file changed, 45 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/usr/local/www/vpn_l2tp_users_edit.php b/src/usr/local/www/vpn_l2tp_users_edit.php index 4a2078a..a0caea6 100644 --- a/src/usr/local/www/vpn_l2tp_users_edit.php +++ b/src/usr/local/www/vpn_l2tp_users_edit.php @@ -121,7 +121,7 @@ if ($_POST) { $input_errors[] = gettext("The password contains invalid characters."); } - if (($_POST['passwordfld']) && ($_POST['passwordfld'] != $_POST['passwordfld2'])) { + if (($_POST['passwordfld']) && ($_POST['passwordfld'] != $_POST['passwordfld_confirm'])) { $input_errors[] = gettext("The passwords do not match."); } if (($_POST['ip'] && !is_ipaddr($_POST['ip']))) { @@ -153,7 +153,7 @@ if ($_POST) { $secretent['name'] = $_POST['usernamefld']; $secretent['ip'] = $_POST['ip']; - if ($_POST['passwordfld']) { + if ($_POST['passwordfld'] && ($_POST['passwordfld'] != DMYPWD)) { $secretent['password'] = $_POST['passwordfld']; } @@ -175,60 +175,52 @@ if ($_POST) { } include("head.inc"); -?> - - -
-
-
-

-
- -
-
- -
- -
-
-
- -
- -
-
-
- -
- - - - -
-
-
- -
- - -
-
-
-
- -
- -
- - - - -
-addInput(new Form_Input( + 'usernamefld', + 'Username', + 'text', + $pconfig['usernamefld'] +)); + +$pwd = new Form_Input( + 'passwordfld', + 'Password', + 'text', + $pconfig['passwordfld'] +); + +if (isset($id) && $a_secret[$id]) { + $pwd->setHelp('If you want to change the users password, enter it here.'); +} + +$section->addPassword($pwd); + +$section->addInput(new Form_IpAddress( + 'ip', + 'IP Address', + $pconfig['ip'] +))->setHelp('If you want the user to be assigned a specific IP address, enter it here.'); + +$form->add($section); + +if (isset($id) && $a_secret[$id]) { + $form->addGlobal(new Form_Input( + 'id', + null, + 'hidden', + $i + )); +} + +print($form); + include("foot.inc"); -- cgit v1.1