diff --git a/new_service.php b/new_service.php index ae944a56df8f955192fe086d1391db07cc94c998..2e246edcd1218231331d2730e342d9d7b4601abb 100644 --- a/new_service.php +++ b/new_service.php @@ -115,6 +115,9 @@ class page_action extends tform_actions { // add domain $domain_id = $remote->insert_query('../client/form/domain.tform.php', $fields['client_id'], array('domain' => $fields['domain'])); + + $min_password_length = 8; + if(isset($server_config_array['misc']['min_password_length'])) $min_password_length = $server_config_array['misc']['min_password_length']; // DNS Zone if($fields['dns']) @@ -357,7 +360,7 @@ class page_action extends tform_actions { // validate, on error skip if( ! preg_match('/^[_a-z0-9][\w\.\-_\+@]{1,63}$/', $mailbox)) continue; - $mailbox_passwords[$mailbox] = substr(sha1(rand()), 0, 10); + $mailbox_passwords[$mailbox] = $app->auth->get_random_password($min_password_length, true); $params = array( 'server_id' => $template['mail_server_id'], @@ -452,7 +455,7 @@ class page_action extends tform_actions { 'server_id' => $template['database_server_id'], 'database_user' => $client_db_prefix . $generated_username, 'database_user_prefix' => $client_db_prefix, - 'database_password' => substr(sha1(rand()), 0, 10) + 'database_password' => $app->auth->get_random_password($min_password_length, true), ); $db_user_id = $remote->insert_query('../sites/form/database_user.tform.php', $fields['client_id'], $db_user_params, 'sites:web_database_user:on_after_insert'); @@ -480,7 +483,7 @@ class page_action extends tform_actions { 'parent_domain_id' => $site_id, 'username' => $client_ftp_prefix . $generated_username, 'username_prefix' => $client_prefix, - 'password' => substr(sha1(rand()), 0, 10), + 'password' => $app->auth->get_random_password($min_password_length, true), 'quota_size' => $template['hd_quota'], 'dir' => $site_data['document_root'], 'uid' => $site_data['system_user'], @@ -517,7 +520,7 @@ class page_action extends tform_actions { if(isset($ftp_params)) { $ssh_params['password'] = $ftp_params['password']; } else { - $ssh_params['password'] = substr(sha1(rand()), 0, 10); + $ssh_params['password'] = $app->auth->get_random_password($min_password_length, true); } $remote->insert_query('../sites/form/shell_user.tform.php', $fields['client_id'], $ssh_params);