autoname calls

implement getRandomName function
This commit is contained in:
Adam Magness 2018-11-08 10:22:20 -05:00
parent 0e01568ccd
commit b99925060a
5 changed files with 6 additions and 5 deletions

View File

@ -31,7 +31,7 @@ function lostpass_post(App $a)
$a->internalRedirect(); $a->internalRedirect();
} }
$pwdreset_token = autoname(12) . mt_rand(1000, 9999); $pwdreset_token = Strings::getRandomName(12) . mt_rand(1000, 9999);
$fields = [ $fields = [
'pwdreset' => $pwdreset_token, 'pwdreset' => $pwdreset_token,

View File

@ -11,6 +11,7 @@ use Friendica\Database\DBA;
use Friendica\Database\DBStructure; use Friendica\Database\DBStructure;
use Friendica\Object\Image; use Friendica\Object\Image;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Strings;
/** /**
* Contains methods for installation purpose of Friendica * Contains methods for installation purpose of Friendica
@ -264,7 +265,7 @@ class Installer
} }
if ($passed2) { if ($passed2) {
$str = autoname(8); $str = Strings::getRandomName(8);
$cmd = "$phppath util/testargs.php $str"; $cmd = "$phppath util/testargs.php $str";
$result = trim(shell_exec($cmd)); $result = trim(shell_exec($cmd));
$passed3 = $result == $str; $passed3 = $result == $str;

View File

@ -78,7 +78,7 @@ class Register
*/ */
public static function createForInvitation() public static function createForInvitation()
{ {
$code = autoname(8) . srand(1000, 9999); $code = Strings::getRandomName(8) . srand(1000, 9999);
$fields = [ $fields = [
'hash' => $code, 'hash' => $code,

View File

@ -270,7 +270,7 @@ class User
*/ */
public static function generateNewPassword() public static function generateNewPassword()
{ {
return autoname(6) . mt_rand(100, 9999); return Strings::getRandomName(6) . mt_rand(100, 9999);
} }
/** /**

View File

@ -68,7 +68,7 @@ class Strings
* *
* @return string * @return string
*/ */
public static function getRandomName($len) // autoname() public static function getRandomName($len)
{ {
if ($len <= 0) { if ($len <= 0) {
return ''; return '';