Updated password verification

This commit is contained in:
bprieshof
2019-12-19 15:27:47 +01:00
parent d3171ee923
commit 6e04f54b3b

View File

@@ -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"