Commit 95188035 authored by tbrehm's avatar tbrehm
Browse files

Fixed: FS#810 - FTP - If username is left blank and client clicks options a...

Fixed: FS#810 - FTP - If username is left blank and client clicks options a clientname_ blank username is created.
parent 2535cf6e
...@@ -83,12 +83,10 @@ $form["tabs"]['ftp'] = array ( ...@@ -83,12 +83,10 @@ $form["tabs"]['ftp'] = array (
'username' => array ( 'username' => array (
'datatype' => 'VARCHAR', 'datatype' => 'VARCHAR',
'formtype' => 'TEXT', 'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', 'validators' => array ( 0 => array ( 'type' => 'UNIQUE',
'errmsg'=> 'username_error_empty'),
1 => array ( 'type' => 'UNIQUE',
'errmsg'=> 'username_error_unique'), 'errmsg'=> 'username_error_unique'),
2 => array ( 'type' => 'REGEX', 1 => array ( 'type' => 'REGEX',
'regex' => '/^[\w\.\-]{1,64}$/', 'regex' => '/^[\w\.\-]{0,64}$/',
'errmsg'=> 'username_error_regex'), 'errmsg'=> 'username_error_regex'),
), ),
'default' => '', 'default' => '',
......
...@@ -83,12 +83,10 @@ $form["tabs"]['shell'] = array ( ...@@ -83,12 +83,10 @@ $form["tabs"]['shell'] = array (
'username' => array ( 'username' => array (
'datatype' => 'VARCHAR', 'datatype' => 'VARCHAR',
'formtype' => 'TEXT', 'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', 'validators' => array ( 0 => array ( 'type' => 'UNIQUE',
'errmsg'=> 'username_error_empty'),
1 => array ( 'type' => 'UNIQUE',
'errmsg'=> 'username_error_unique'), 'errmsg'=> 'username_error_unique'),
2 => array ( 'type' => 'REGEX', 1 => array ( 'type' => 'REGEX',
'regex' => '/^[\w\.\-]{1,64}$/', 'regex' => '/^[\w\.\-]{0,64}$/',
'errmsg'=> 'username_error_regex'), 'errmsg'=> 'username_error_regex'),
), ),
'default' => '', 'default' => '',
......
...@@ -108,6 +108,11 @@ class page_action extends tform_actions { ...@@ -108,6 +108,11 @@ class page_action extends tform_actions {
// Set a few fixed values // Set a few fixed values
$this->dataRecord["server_id"] = $parent_domain["server_id"]; $this->dataRecord["server_id"] = $parent_domain["server_id"];
//die(print_r($this->dataRecord));
if(isset($this->dataRecord['username']) && trim($this->dataRecord['username']) == '') $app->tform->errorMessage .= $app->tform->lng('username_error_empty').'<br />';
if(isset($this->dataRecord['username']) && empty($this->dataRecord['parent_domain_id'])) $app->tform->errorMessage .= $app->tform->lng('parent_domain_id_error_empty').'<br />';
parent::onSubmit(); parent::onSubmit();
} }
......
...@@ -24,4 +24,5 @@ $wb["uid_error_empty"] = 'UID empty.'; ...@@ -24,4 +24,5 @@ $wb["uid_error_empty"] = 'UID empty.';
$wb["uid_error_empty"] = 'GID empty.'; $wb["uid_error_empty"] = 'GID empty.';
$wb["directory_error_empty"] = 'Directory empty.'; $wb["directory_error_empty"] = 'Directory empty.';
$wb['directory_error_notinweb'] = 'Directory not inside of web root directory.'; $wb['directory_error_notinweb'] = 'Directory not inside of web root directory.';
$wb["parent_domain_id_error_empty"] = 'No website selected.';
?> ?>
...@@ -19,4 +19,5 @@ $wb["uid_error_empty"] = 'UID empty.'; ...@@ -19,4 +19,5 @@ $wb["uid_error_empty"] = 'UID empty.';
$wb["uid_error_empty"] = 'GID empty.'; $wb["uid_error_empty"] = 'GID empty.';
$wb["directory_error_empty"] = 'Directory empty.'; $wb["directory_error_empty"] = 'Directory empty.';
$wb["limit_shell_user_txt"] = 'The max number of shell users is reached.'; $wb["limit_shell_user_txt"] = 'The max number of shell users is reached.';
$wb["parent_domain_id_error_empty"] = 'No website selected.';
?> ?>
...@@ -115,6 +115,9 @@ class page_action extends tform_actions { ...@@ -115,6 +115,9 @@ class page_action extends tform_actions {
// Set a few fixed values // Set a few fixed values
$this->dataRecord["server_id"] = $parent_domain["server_id"]; $this->dataRecord["server_id"] = $parent_domain["server_id"];
if(isset($this->dataRecord['username']) && trim($this->dataRecord['username']) == '') $app->tform->errorMessage .= $app->tform->lng('username_error_empty').'<br />';
if(isset($this->dataRecord['username']) && empty($this->dataRecord['parent_domain_id'])) $app->tform->errorMessage .= $app->tform->lng('parent_domain_id_error_empty').'<br />';
parent::onSubmit(); parent::onSubmit();
} }
...@@ -129,7 +132,7 @@ class page_action extends tform_actions { ...@@ -129,7 +132,7 @@ class page_action extends tform_actions {
} }
} }
unset($blacklist); unset($blacklist);
/* /*
* If the names should be restricted -> do it! * If the names should be restricted -> do it!
*/ */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment