Added new password validator

This commit is contained in:
bprieshof
2019-12-18 13:43:41 +01:00
parent 10c111f780
commit fb55b0b2f2

View File

@@ -30,6 +30,36 @@ echo "$1"
fi
}
function PasswordQuest {
passdiaone=$(whiptail --nocancel --passwordbox "Please enter your password (should contain at least 2 digits and 6 characters)" 11 82 --title "Config" 3>&1 1>&2 2>&3)
if [ -z $passdiaone ]; then PasswordQuest; fi
if [ ${#passdiaone} -lt 8 ]; then whiptail --ok-button Done --msgbox "Password is not long enough!" 10 30 && PasswordQuest;else PasswordCheck; fi
}
function PasswordCheck {
#Checking password
passdiatwo=$(whiptail --nocancel --passwordbox "Please re-enter your password" 11 82 --title "Config" 3>&1 1>&2 2>&3)
if [ -z $passdiatwo ]; then PasswordCheck; fi
if [ $passdiaone != $passdiatwo ]; then whiptail --ok-button Done --msgbox "Password does not match!" 10 30 && PasswordQuest; fi
password=$passdiaone
unset passdiaone passdiatwo
}
function LegacyPasswordQuest {
echo "Please enter your password (should contain at least 2 digits and 6 characters)"
read -s passdiaone
if [ -z $passdiaone ]; then PasswordQuest; fi
if [ ${#passdiaone} -lt 8 ]; then echo "Password is not long enough!" && LegacyPasswordQuest;else LegacyPasswordCheck; fi
}
function LegacyPasswordCheck {
#Checking password
echo "Please re-enter your password"
read -s passdiatwo
if [ -z $passdiatwo ]; then LegacyPasswordCheck; fi
if [ $passdiaone != $passdiatwo ]; then echo "Password does not match!" && LegacyPasswordQuest; fi
password=$passdiaone
unset passdiaone passdiatwo
}
##---------------##
# Static-Vars #
@@ -75,7 +105,7 @@ if (whiptail --title "Config" --yesno "Enable SSL on installation?" 11 82); then
else
sslenable=0
fi
password=$(whiptail --nocancel --passwordbox "Please enter your password (should contain at least 2 digits and 6 characters)" 11 82 --title "Config" 3>&1 1>&2 2>&3)
PasswordQuest
email=$(whiptail --nocancel --inputbox " Enter the administrator e-mail" 11 82 --title "Config" 3>&1 1>&2 2>&3)
webserv=$(whiptail --title "Select Webserver" --radiolist "WebServer" 11 53 5 "Nginx:" "Will install NGINX Webserver." ON "Apache:" "Will install Apache Webserver." OFF 3>&1 1>&2 2>&3)
esws=$?
@@ -121,8 +151,7 @@ while true; do
* ) echo "Choose yes of no.";;
esac
done
echo "Please enter your password (should contain at least 2 digits and 6 characters:"
read password
LegacyPasswordQuest
echo "Administrator E-mail:"
read email