diff --git a/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh b/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh index ef3a6e9..80f765c 100755 --- a/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh +++ b/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh @@ -481,7 +481,6 @@ case "$ACTION" in $0 crypto-down $0 config-down box_purge - $0 diskinfo ;; poweroff ) is_crypto_mounted && umount_crypto diff --git a/cbox-tree.d/var/www/cgi-bin/cryptobox.pl b/cbox-tree.d/var/www/cgi-bin/cryptobox.pl index 6e306f3..91c4fee 100755 --- a/cbox-tree.d/var/www/cgi-bin/cryptobox.pl +++ b/cbox-tree.d/var/www/cgi-bin/cryptobox.pl @@ -615,20 +615,18 @@ if ( ! &check_ssl()) { $pagedata->setValue('Data.Redirect.Delay', "60"); } ################### box_purge ####################### - # TODO test this code - # if we find an existing config partition, then read the adminpw - # and ask the user (validationscript or webfrontend) for it - } elsif ($action eq 'box_purge') { + # if we find an existing config partition, then check the adminpw + } elsif ($action eq 'do_purge') { if ( &check_config()) { - # TODO old config found, read the admin passwd my $current_admin_pw = &get_admin_pw; - if ($current_admin_pw ne $query->param('current_admin_password')) { + if ($current_admin_pw ne '' && $current_admin_pw ne $query->param('current_admin_password')) { $pagedata->setValue('Data.Warning', 'WrongAdminPassword'); $pagedata->setValue('Data.Action', 'form_config'); } else { - &box_purge; + &box_purge; + $pagedata->setValue('Data.Action', 'form_init'); + } } - } ################### unknown ######################### } else { $pagedata->setValue('Data.Error', 'UnknownAction'); diff --git a/validation/test-cases/1-init/000-main/description b/validation/test-cases/1-init/000-main/description index 09b8487..980eb91 100644 --- a/validation/test-cases/1-init/000-main/description +++ b/validation/test-cases/1-init/000-main/description @@ -1 +1 @@ -show the main page +purge the box diff --git a/validation/test-cases/1-init/000-main/input.curl b/validation/test-cases/1-init/000-main/input.curl index d0405a7..164e898 100644 --- a/validation/test-cases/1-init/000-main/input.curl +++ b/validation/test-cases/1-init/000-main/input.curl @@ -1,2 +1,4 @@ url https://_HOST_IP_DEFAULT_/cryptobox data weblang=_IFACE_LANG_ +data action=do_purge +data current_admin_password=