Commit 84569173 authored by tbrehm's avatar tbrehm

Fixed: FS#2176 - collision between shell/ftp accounts and client accounts...

Fixed: FS#2176 - collision between shell/ftp accounts and client accounts named webXX is not checked
parent 471560c6
......@@ -65,6 +65,36 @@ class validate_client {
}
}
function username_collision($field_name, $field_value, $validator) {
global $app;
if(isset($app->remoting_lib->primary_id)) {
$client_id = $app->remoting_lib->primary_id;
} else {
$client_id = $app->tform->primary_id;
}
$app->uses('getconf');
$global_config = $app->getconf->get_global_config('sites');
if(substr($field_value,0,3) == 'web' &&
($global_config['ftpuser_prefix'] == '[CLIENTNAME]' ||
$global_config['ftpuser_prefix'] == '' ||
$global_config['shelluser_prefix'] == '[CLIENTNAME]' ||
$global_config['shelluser_prefix'] == '' )) {
$errmsg = $validator['errmsg'];
if(isset($app->tform->wordbook[$errmsg])) {
return $app->tform->wordbook[$errmsg]."<br>\r\n";
} else {
return $errmsg."<br>\r\n";
}
}
}
......
<?php
/*
Copyright (c) 2005 - 2008, Till Brehm, projektfarm Gmbh
Copyright (c) 2005 - 2012, Till Brehm, projektfarm Gmbh, ISPConfig UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
......
......@@ -126,7 +126,11 @@ $form["tabs"]['address'] = array (
'class' => 'validate_client',
'function' => 'username_unique',
'errmsg'=> 'username_error_unique'),
2 => array ( 'type' => 'REGEX',
2 => array ( 'type' => 'CUSTOM',
'class' => 'validate_client',
'function' => 'username_collision',
'errmsg'=> 'username_error_collision'),
3 => array ( 'type' => 'REGEX',
'regex' => '/^[\w\.\-\_]{0,64}$/',
'errmsg'=> 'username_error_regex'),
),
......
......@@ -126,7 +126,11 @@ $form["tabs"]['address'] = array (
'class' => 'validate_client',
'function' => 'username_unique',
'errmsg'=> 'username_error_unique'),
2 => array ( 'type' => 'REGEX',
2 => array ( 'type' => 'CUSTOM',
'class' => 'validate_client',
'function' => 'username_collision',
'errmsg'=> 'username_error_collision'),
3 => array ( 'type' => 'REGEX',
'regex' => '/^[\w\.\-\_]{0,64}$/',
'errmsg'=> 'username_error_regex'),
),
......
......@@ -109,4 +109,5 @@ $wb["limit_openvz_vm_template_id_txt"] = 'Force virtual server template';
$wb["limit_openvz_vm_error_notint"] = 'The virtual server limit must be a number.';
$wb["web_php_options_notempty"] = 'No PHP option(s) selected. Select at least one PHP option.';
$wb["ssh_chroot_notempty"] = 'No SSH chroot option selected. Select at least one SSH option.';
$wb["username_error_collision"] = 'The username may not start with the word - web -';
?>
......@@ -108,4 +108,5 @@ $wb["limit_openvz_vm_template_id_txt"] = 'Force virtual server template';
$wb["limit_openvz_vm_error_notint"] = 'The virtual server limit must be a number.';
$wb["web_php_options_notempty"] = 'No PHP option(s) selected. Select at least one PHP option.';
$wb["ssh_chroot_notempty"] = 'No SSH chroot option selected. Select at least one SSH option.';
$wb["username_error_collision"] = 'The username may not start with the word - web -';
?>
Markdown is supported
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