feat: add password confirmation loop and mask input

- Implements a validation loop that requires the user to re-enter their password until both inputs match.
- Adds the '-s' flag to the 'read' to prevent form being echoed to the terminal.
This commit is contained in:
YerdosNar
2025-12-03 20:21:41 +09:00
parent 07e8915492
commit bcb03c3d5b

16
menu.sh
View File

@ -728,12 +728,24 @@ webpanel_handler() {
done
while true; do
read -e -p "Enter the admin password: " admin_password
read -sp "Enter the admin password: " admin_password
echo ""
if [ -z "$admin_password" ]; then
echo "Admin password cannot be empty. Please try again."
else
continue
fi
local check_password
read -sp "Enter the admin password again: " check_password
echo ""
if [ -z "$check_password" ]; then
echo "Admin password cannot be empty. Please try again."
continue
fi
if [ "$check_password" == "$admin_password" ]; then
echo "Password is set!"
break
fi
echo "Passwords did NOT match. Please try again."
done
python3 $CLI_PATH webpanel -a start -d "$domain" -p "$port" -au "$admin_username" -ap "$admin_password"