Enhance config_file function to implement robust password validation and user feedback for root password setup
This commit is contained in:
parent
d8947336f3
commit
36809a99dc
@ -870,8 +870,36 @@ config_file() {
|
|||||||
fi
|
fi
|
||||||
PW="-password $PW"
|
PW="-password $PW"
|
||||||
else
|
else
|
||||||
PW=""
|
while true; do
|
||||||
echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}Automatic Login${CL}"
|
if PW1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD (leave blank for automatic login)" 3>&1 1>&2 2>&3); then
|
||||||
|
if [[ -n "$PW1" ]]; then
|
||||||
|
if [[ "$PW1" == *" "* ]]; then
|
||||||
|
whiptail --msgbox "Password cannot contain spaces. Please try again." 8 58
|
||||||
|
elif [ ${#PW1} -lt 5 ]; then
|
||||||
|
whiptail --msgbox "Password must be at least 5 characters long. Please try again." 8 58
|
||||||
|
else
|
||||||
|
if PW2=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "\nVerify Root Password" 9 58 --title "PASSWORD VERIFICATION" 3>&1 1>&2 2>&3); then
|
||||||
|
if [[ "$PW1" == "$PW2" ]]; then
|
||||||
|
PW="-password $PW1"
|
||||||
|
echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}********${CL}"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
whiptail --msgbox "Passwords do not match. Please try again." 8 58
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exit_script
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
PW1="Automatic Login"
|
||||||
|
PW=""
|
||||||
|
echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}$PW1${CL}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exit_script
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$HN" ]]; then
|
if [[ -n "$HN" ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user