Added new password validator
This commit is contained in:
35
installer.sh
35
installer.sh
@@ -30,6 +30,36 @@ echo "$1"
|
|||||||
fi
|
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 #
|
# Static-Vars #
|
||||||
@@ -75,7 +105,7 @@ if (whiptail --title "Config" --yesno "Enable SSL on installation?" 11 82); then
|
|||||||
else
|
else
|
||||||
sslenable=0
|
sslenable=0
|
||||||
fi
|
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)
|
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)
|
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=$?
|
esws=$?
|
||||||
@@ -121,8 +151,7 @@ while true; do
|
|||||||
* ) echo "Choose yes of no.";;
|
* ) echo "Choose yes of no.";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
echo "Please enter your password (should contain at least 2 digits and 6 characters:"
|
LegacyPasswordQuest
|
||||||
read password
|
|
||||||
echo "Administrator E-mail:"
|
echo "Administrator E-mail:"
|
||||||
read email
|
read email
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user