From 6e04f54b3b0f4c8d819e6ed0636edbc103e2a079 Mon Sep 17 00:00:00 2001 From: bprieshof Date: Thu, 19 Dec 2019 15:27:47 +0100 Subject: [PATCH] Updated password verification --- installer.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/installer.sh b/installer.sh index 184dfcc..dd48589 100644 --- a/installer.sh +++ b/installer.sh @@ -33,7 +33,11 @@ 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 +if [[ ${#passdiaone} -ge 8 && "$passdiaone" == *[[:lower:]]* && "$passdiaone" == *[[:upper:]]* && "$passdiaone" == *[0-9]* && "$passdiaone" == *['!'@#%^\&*()_+]* ]]; then + PasswordCheck +else + whiptail --ok-button Done --msgbox "Password is invalid!" 10 30 && PasswordQuest +fi } function PasswordCheck { #Checking password @@ -44,11 +48,16 @@ fi } function LegacyPasswordQuest { -echo "Please enter your password (should contain at least 2 digits and 6 characters)" +echo "Enter password (Requires: 8 chars, 1 capital and 1 num)" read -s passdiaone if [ -z $passdiaone ]; then PasswordQuest; fi -if [ ${#passdiaone} -lt 8 ]; then echo "Password is not long enough!" && LegacyPasswordQuest;else LegacyPasswordCheck; fi +if [[ ${#passdiaone} -ge 8 && "$passdiaone" == *[[:lower:]]* && "$passdiaone" == *[[:upper:]]* && "$passdiaone" == *[0-9]* && "$passdiaone" == *['!'@#%^\&*()_+]* ]]; then + LegacyPasswordCheck +else + echo "Password is invalid!" 10 30 && LegacyPasswordQuest +fi } + function LegacyPasswordCheck { #Checking password echo "Please re-enter your password"