Validate vhosts names more strictly

There was a bug in the setup page where valid domains that start with a number
would be captured by the validation check designed to detect IP
addresses. This check detects IPs by comparing the host name to a regex,
instead of simply detecting whether the first character is a number.
This commit is contained in:
Lucas Wilson-Richter
2014-03-09 09:43:33 +11:00
parent 0c49481282
commit 3fcc49ff00

View File

@@ -104,7 +104,7 @@ __END__
});
}
function update() {
if ($("#vhost").is(":checked") && !isNaN($("#hostname").val()[0])) {
if ($("#vhost").is(":checked") && $("#hostname").val().match(/(\d{1,3}\.){3}\d{1,3}/)) {
alert("In order to use virtualhost naming, the hostname must not be an IP but a valid domain name.")
$("#vhost").prop('checked', false);
}