Migrate Password Protection & Lockout menu; add missing ask_time helper; bump to v2.2.0
Fifth menu migrated onto lib/menu.sh + lib/config.sh: menus/lockout.sh covers enable/disable, changing the password, inactivity timeout, daily lock time, and boot password. The password is SHA-256 hashed before it's ever assigned to LOCKOUT_PASSWORD (matching main.js's comparison logic) - verified by test that the stored value is the correct hash and never plaintext. Rewrote the legacy configure_password_protection's linear "ask everything, confirm save at the end" wizard as the same immediate-save pattern used by every other migrated menu: each action (change password, change timeout, toggle boot password, ...) is a complete, standalone change, consistent with Sites/Display/Timezone/Hidden PIN. LOCKOUT_ACTIVE_START/END are deliberately left untouched - per the Readme they're inert leftover fields the app ignores, so lib/config.sh just carries whatever is already in config.json through unchanged. Testing this menu surfaced a real gap before it ever shipped: lib/menu.sh never had ask_time/validate_time at all (only validate_integer/ask_integer, ask_url, etc were ported when the framework was first built) - "set a daily lock time" would have failed for every single user with "ask_time: command not found". Ported both from the legacy script. Also promoted the ON/OFF toggle-label helper (previously private to menus/display.sh as display_onoff) to a shared onoff() in lib/menu.sh, since menus/lockout.sh needed the same thing and menu files should only ever depend on lib/, never on each other. Bumped SCRIPT_VERSION to 2.2.0 with matching changelog entries in the script header and Readme, and updated "Modular Management" to list the new menu and drop Password Protection & Lockout from the "not yet migrated" list. Verified: - Full regression: re-ran the Sites, Display, Timezone/PIN scratch-config suites after every change in this round (the onoff refactor, and again after adding ask_time) - all still clean. - New scratch-config test for lockout.sh: enable (password+timeout+daily lock+boot toggle), independently recomputed the expected SHA-256 hash and confirmed it matches config.json exactly, change password, change timeout, clear daily lock, toggle boot password, disable (confirmed every field clears), and that the menu builder's options correctly differ between the enabled and disabled states. - End-to-end: ran the real install.sh as a genuine non-root, non-"kiosk" user - Lockout menu -> enable protection with a real password entered via the masked prompt -> set 20m timeout, 23:00 daily lock, boot password on -> confirmed the menu redraws with the new state -> clean exit (code 0). Checked the resulting config.json and file permissions on disk.
This commit is contained in:
+15
-2
@@ -1,8 +1,21 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
### Ubuntu Based Kiosk v2.1.0 ###
|
||||
### Ubuntu Based Kiosk v2.2.0 ###
|
||||
################################################################################
|
||||
#
|
||||
# RELEASE v2.2.0 - Password Protection & Lockout Migrated
|
||||
# - New in ./install.sh: Password Protection & Lockout (menus/lockout.sh) -
|
||||
# enable/disable, change password (SHA-256 hashed before it's ever
|
||||
# written to disk, matching main.js's comparison logic - never
|
||||
# plaintext), inactivity timeout, daily lock time, boot password.
|
||||
# - Fixed: lib/menu.sh was missing ask_time/validate_time entirely (only
|
||||
# caught by testing this menu, before it shipped - "Set daily lock
|
||||
# time" would have failed with "ask_time: command not found" for every
|
||||
# user). Ported from the legacy script; also promoted the ON/OFF
|
||||
# toggle-label helper (previously private to menus/display.sh) to a
|
||||
# shared `onoff()` in lib/menu.sh so menus/lockout.sh doesn't have to
|
||||
# depend on menus/display.sh - menus should only ever depend on lib/.
|
||||
#
|
||||
# RELEASE v2.1.0 - Two More Menus Migrated, Menu Framework Hardened
|
||||
# - New in ./install.sh: Timezone (menus/timezone.sh) and Hidden Site PIN
|
||||
# (menus/hidden_pin.sh) menus, alongside Sites & Page Timing and Display
|
||||
@@ -109,7 +122,7 @@ set -euo pipefail
|
||||
### SECTION 1: CONSTANTS & GLOBALS
|
||||
################################################################################
|
||||
|
||||
SCRIPT_VERSION="2.1.0"
|
||||
SCRIPT_VERSION="2.2.0"
|
||||
|
||||
# Resolve the real path to this script file.
|
||||
# When piped (curl|bash or wget|bash), BASH_SOURCE[0] is a pipe descriptor,
|
||||
|
||||
Reference in New Issue
Block a user