From c8b10b4ce59161e21a93786d04237ad3f330178a Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Mon, 28 Dec 2015 16:11:17 -0500 Subject: Added new addPassword method and password == password_confirm validation where required. --- src/usr/local/www/diag_backup.php | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) (limited to 'src/usr/local/www/diag_backup.php') diff --git a/src/usr/local/www/diag_backup.php b/src/usr/local/www/diag_backup.php index bcf3619..173da92 100644 --- a/src/usr/local/www/diag_backup.php +++ b/src/usr/local/www/diag_backup.php @@ -225,10 +225,10 @@ if ($_POST) { if ($mode) { if ($mode == "download") { if ($_POST['encrypt']) { - if (!$_POST['encrypt_password'] || !$_POST['encrypt_passconf']) { + if (!$_POST['encrypt_password'] || !$_POST['encrypt_password_confirm']) { $input_errors[] = gettext("You must supply and confirm the password for encryption."); } - if ($_POST['encrypt_password'] != $_POST['encrypt_passconf']) { + if ($_POST['encrypt_password'] != $_POST['encrypt_password_confirm']) { $input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match."); } } @@ -303,10 +303,10 @@ if ($_POST) { if ($mode == "restore") { if ($_POST['decrypt']) { - if (!$_POST['decrypt_password'] || !$_POST['decrypt_passconf']) { + if (!$_POST['decrypt_password'] || !$_POST['decrypt_password_confirm']) { $input_errors[] = gettext("You must supply and confirm the password for decryption."); } - if ($_POST['decrypt_password'] != $_POST['decrypt_passconf']) { + if ($_POST['decrypt_password'] != $_POST['decrypt_password_confirm']) { $input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match."); } } @@ -659,20 +659,11 @@ $section->addInput(new Form_Checkbox( false )); -$section->addInput(new Form_Input( +$section->addPassword(new Form_Input( 'encrypt_password', - null, - 'password', - null, - ['placeholder' => 'Password'] -)); - -$section->addInput(new Form_Input( - 'encrypt_passconf', - null, + 'Password', 'password', - null, - ['placeholder' => 'Confirm password'] + null )); $group = new Form_Group(''); @@ -712,22 +703,14 @@ $section->addInput(new Form_Checkbox( false )); -$section->addInput(new Form_Input( +$section->addPassword(new Form_Input( 'decrypt_password', - null, + 'Password', 'password', null, ['placeholder' => 'Password'] )); -$section->addInput(new Form_Input( - 'decrypt_passconf', - null, - 'password', - null, - ['placeholder' => 'Confirm password'] -)); - $group = new Form_Group(''); $group->add(new Form_Button( 'Submit', @@ -782,9 +765,9 @@ events.push(function() { decryptHide = !($('input[name="decrypt"]').is(':checked')); hideInput('encrypt_password', encryptHide); - hideInput('encrypt_passconf', encryptHide); + hideInput('encrypt_password_confirm', encryptHide); hideInput('decrypt_password', decryptHide); - hideInput('decrypt_passconf', decryptHide); + hideInput('decrypt_password_confirm', decryptHide); } // ---------- Click handlers ------------------------------------------------------------------ -- cgit v1.1