Update password handling in config_file function to use PW_CONFIG for clarity and improve validation checks
This commit is contained in:
parent
8fb0cc90a7
commit
bd5eeaca30
@ -310,7 +310,7 @@ BRG="${BRG}"
|
|||||||
APT_CACHER_IP="${APT_CACHER_IP}"
|
APT_CACHER_IP="${APT_CACHER_IP}"
|
||||||
DISABLEIP6="${DISABLEIP6}"
|
DISABLEIP6="${DISABLEIP6}"
|
||||||
TAGS="${TAGS}"
|
TAGS="${TAGS}"
|
||||||
PW="${PW1}"
|
PW="${PW_CONFIG}"
|
||||||
SSH="${SSH}"
|
SSH="${SSH}"
|
||||||
SSH_AUTHORIZED_KEY="${SSH_AUTHORIZED_KEY}"
|
SSH_AUTHORIZED_KEY="${SSH_AUTHORIZED_KEY}"
|
||||||
VERBOSE="${VERBOSE}"
|
VERBOSE="${VERBOSE}"
|
||||||
@ -334,7 +334,7 @@ BRG="${BRG}"
|
|||||||
APT_CACHER_IP="${APT_CACHER_IP}"
|
APT_CACHER_IP="${APT_CACHER_IP}"
|
||||||
DISABLEIP6="${DISABLEIP6}"
|
DISABLEIP6="${DISABLEIP6}"
|
||||||
TAGS="${TAGS}"
|
TAGS="${TAGS}"
|
||||||
PW="${PW1}"
|
PW="${PW_CONFIG}"
|
||||||
SSH="${SSH}"
|
SSH="${SSH}"
|
||||||
SSH_AUTHORIZED_KEY="${SSH_AUTHORIZED_KEY}"
|
SSH_AUTHORIZED_KEY="${SSH_AUTHORIZED_KEY}"
|
||||||
VERBOSE="${VERBOSE}"
|
VERBOSE="${VERBOSE}"
|
||||||
@ -858,17 +858,22 @@ config_file() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ -n "${PW-}" ]]; then
|
if [[ -n "${PW-}" ]]; then
|
||||||
if [[ "$PW" == *" "* ]]; then
|
if [[ "$PW" == "no" ]]; then
|
||||||
msg_error "Password cannot be empty"
|
PW=""
|
||||||
exit
|
|
||||||
elif [[ ${#PW} -lt 5 ]]; then
|
|
||||||
msg_error "Password must be at least 5 characters long"
|
|
||||||
exit
|
|
||||||
else
|
else
|
||||||
echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}********${CL}"
|
if [[ "$PW" == *" "* ]]; then
|
||||||
|
msg_error "Password cannot be empty"
|
||||||
|
exit
|
||||||
|
elif [[ ${#PW} -lt 5 ]]; then
|
||||||
|
msg_error "Password must be at least 5 characters long"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}********${CL}"
|
||||||
|
fi
|
||||||
|
PW="-password $PW"
|
||||||
fi
|
fi
|
||||||
PW="-password $PW"
|
|
||||||
else
|
else
|
||||||
while true; do
|
while true; do
|
||||||
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 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
|
||||||
@ -893,6 +898,7 @@ config_file() {
|
|||||||
else
|
else
|
||||||
PW1="Automatic Login"
|
PW1="Automatic Login"
|
||||||
PW=""
|
PW=""
|
||||||
|
PW_CONFIG="no"
|
||||||
echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}$PW1${CL}"
|
echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}$PW1${CL}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user