Added jail name validation

This commit is contained in:
Jose
2020-05-09 16:05:41 -04:00
parent e6cd90ed09
commit d053566c15
3 changed files with 8 additions and 1 deletions
+6
View File
@@ -100,6 +100,12 @@ if ($_POST):
// Input validation.
// Perform some simple validations for now.
if(isset($_POST['jname']) && ($pconfig['jname'])):
if(!preg_match('/^[A-Za-z0-9-_]+$/D', $pconfig['jname'])):
$input_errors[] = gtext("A valid jail name must be specified.");
endif;
endif;
if(isset($_POST['hostname']) && ($pconfig['hostname'])):
if(preg_match('/\s/', $pconfig['hostname'])):
$input_errors[] = gtext("A valid hostname must be specified.");