Fixed: FS#2176 - collision between shell/ftp accounts and client accounts named webXX is not checked
| | |
| | | } |
| | | } |
| | | |
| | | 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, |
| | |
| | | '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'), |
| | | ), |
| | |
| | | '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'), |
| | | ), |
| | |
| | | $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 -'; |
| | | ?> |
| | |
| | | $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 -'; |
| | | ?> |