use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Strings;
/**
* Class interacting with the register database table
* Return the list of pending registrations
*
* @return array
+ * @throws \Exception
*/
public static function getPending()
{
* Returns the pending registration count
*
* @return int
+ * @throws \Exception
*/
public static function getPendingCount()
{
*
* @param string $hash
* @return array
+ * @throws \Exception
*/
public static function getByHash($hash)
{
/**
* Returns true if a register record exists with the provided hash
*
- * @param string $hash
+ * @param string $hash
* @return boolean
+ * @throws \Exception
*/
public static function existsByHash($hash)
{
* Creates a register record for an invitation and returns the auto-generated code for it
*
* @return string
+ * @throws \Exception
*/
public static function createForInvitation()
{
- $code = autoname(8) . srand(1000, 9999);
+ $code = Strings::getRandomName(8) . srand(1000, 9999);
$fields = [
'hash' => $code,
* @param string $language The registration language
* @param string $note An additional message from the user
* @return boolean
+ * @throws \Exception
*/
public static function createForApproval($uid, $language, $note = '')
{
- $hash = random_string();
+ $hash = Strings::getRandomHex();
if (!User::exists($uid)) {
return false;
/**
* Deletes a register record by the provided hash and returns the success of the database deletion
*
- * @param string $hash
+ * @param string $hash
* @return boolean
+ * @throws \Exception
*/
public static function deleteByHash($hash)
{