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:
16
menu.sh
16
menu.sh
@ -728,12 +728,24 @@ webpanel_handler() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
while true; do
|
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
|
if [ -z "$admin_password" ]; then
|
||||||
echo "Admin password cannot be empty. Please try again."
|
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
|
break
|
||||||
fi
|
fi
|
||||||
|
echo "Passwords did NOT match. Please try again."
|
||||||
done
|
done
|
||||||
|
|
||||||
python3 $CLI_PATH webpanel -a start -d "$domain" -p "$port" -au "$admin_username" -ap "$admin_password"
|
python3 $CLI_PATH webpanel -a start -d "$domain" -p "$port" -au "$admin_username" -ap "$admin_password"
|
||||||
|
|||||||
Reference in New Issue
Block a user