Skip to content

Commit

Permalink
domain check improved
Browse files Browse the repository at this point in the history
Added: Can not start with point and can not contain two points together.
  • Loading branch information
QROkes committed Nov 2, 2018
1 parent 2f3bde8 commit 71f7714
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/sites
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ domain_check() {

# Can not start or end with a hyphen
[[ $(echo "${din}" | cut -c-1) == "-" || $(echo "${din}" | rev | cut -c-1) == "-" ]] && domfail="true"


# Can not contain two points together and can not start or end with a point
[[ $din == *..* || $(echo "${din}" | cut -c-1) == "." || $(echo "${din}" | rev | cut -c-1) == "." ]] && domfail="true"

[[ $domfail == "true" ]] && echo "${red}[WARNING] Domain names can only contain letters, numbers or a hyphen; can not start or end with a hyphen and can be up to 67 characters long.${end}"
}

Expand Down Expand Up @@ -481,7 +484,7 @@ deletesite() {
createsite() {
# Check domain and then prevent reserved characters for file names.
domain_check $domain
domain=$(echo $domain | sed "s/[^\.0-9A-Za-z\-]/_/g")
domain=$(echo $domain | sed "s/[^\.0-9A-Za-z\-]/_/g" | sed "s/^[\.]/_/g" | sed "s/\.\./_/g")

if [[ $(conf_read php) != "true" && ("$wp" == [123] || "$type" == "-php") ]]; then
echo "${red}"
Expand Down

0 comments on commit 71f7714

Please sign in to comment.