mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-21 20:34:57 +09:00
hosting username as first 8 domain characters
for set hosting username using first 8 domain characters before activating hosting order
This commit is contained in:
1 parent
f028d18f96
commit
e64244ff6b
1 file changed
+8
-10
@@ -112,8 +112,8 @@ class Service implements InjectionAwareInterface
|
||||
if(isset($c['username']) && !empty($c['username'])) {
|
||||
$username = $c['username'];
|
||||
} else {
|
||||
$username = $this->_generateUsername();
|
||||
}
|
||||
$username = $this->_generateUsername($model->sld.$model->tld);
|
||||
}
|
||||
|
||||
$model->username = $username;
|
||||
$model->pass = $pass;
|
||||
@@ -383,14 +383,12 @@ class Service implements InjectionAwareInterface
|
||||
* Generate username by domain
|
||||
*
|
||||
*/
|
||||
private function _generateUsername()
|
||||
private function _generateUsername($domain_name)
|
||||
{
|
||||
$num1 = rand(10000, 99999);
|
||||
$num2 = rand(10000, 99999);
|
||||
$username = $num1 . $num2;
|
||||
$username = substr($username, 0, 8); // max length 8
|
||||
$username[0] = "u";
|
||||
|
||||
$username = preg_replace('/[^A-Za-z0-9]/', '', $domain_name);
|
||||
$username = substr($username,0,7);
|
||||
$randnum = rand(0, 9);
|
||||
$username = $username . $randnum;
|
||||
return $username;
|
||||
}
|
||||
|
||||
@@ -957,4 +955,4 @@ class Service implements InjectionAwareInterface
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user