Added function valid_domain to check user input of custom domain

This commit is contained in:
Alex Heidenreich 2019-03-10 20:06:49 -04:00
parent 3a0d6b1b47
commit 0cd9e0deb6

View file

@ -380,6 +380,18 @@ function valid_ip()
return $stat
}
#Call this function to use a regex to check user input for a valid custom domain
function valid_domain()
{
local domain=$1
local stat=1
if [[ $domain =~ ^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}\.[a-zA-Z]{2,}$ ]]; then
stat=$?
fi
return $stat
}
installScripts() {
# Install the scripts from /etc/.pivpn to their various locations
$SUDO echo ":::"