mirror of
https://github.com/friendica/friendica
synced 2025-04-22 17:10:11 +00:00
Move "User::deny()" to own method and update usages
This commit is contained in:
parent
6aee153bbd
commit
b4f6e8fda1
4 changed files with 49 additions and 35 deletions
|
@ -941,6 +941,34 @@ class User
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Denys a pending registration
|
||||
*
|
||||
* @param string $hash The hash of the pending user
|
||||
*
|
||||
* This does not have to go through user_remove() and save the nickname
|
||||
* permanently against re-registration, as the person was not yet
|
||||
* allowed to have friends on this system
|
||||
*
|
||||
* @return bool True, if the deny was successfull
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function deny(string $hash)
|
||||
{
|
||||
$register = Register::getByHash($hash);
|
||||
if (!DBA::isResult($register)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = User::getById($register['uid']);
|
||||
if (!DBA::isResult($user)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return DBA::delete('user', ['uid' => $register['uid']]) &&
|
||||
Register::deleteByHash($register['hash']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new user based on a minimal set and sends an email to this user
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue