mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
Users: Do not delete subscriptions when banned for flood requests
It wasn't cool
This commit is contained in:
parent
a3167ab828
commit
0a6ce0ffc0
2 changed files with 12 additions and 10 deletions
|
@ -698,16 +698,18 @@ class User extends RowModel
|
|||
]);
|
||||
}
|
||||
|
||||
function ban(string $reason): void
|
||||
function ban(string $reason, bool $deleteSubscriptions = true): void
|
||||
{
|
||||
$subs = DatabaseConnection::i()->getContext()->table("subscriptions");
|
||||
$subs = $subs->where(
|
||||
"follower = ? OR (target = ? AND model = ?)",
|
||||
$this->getId(),
|
||||
$this->getId(),
|
||||
get_class($this),
|
||||
);
|
||||
$subs->delete();
|
||||
if($deleteSubscriptions) {
|
||||
$subs = DatabaseConnection::i()->getContext()->table("subscriptions");
|
||||
$subs = $subs->where(
|
||||
"follower = ? OR (target = ? AND model = ?)",
|
||||
$this->getId(),
|
||||
$this->getId(),
|
||||
get_class($this),
|
||||
);
|
||||
$subs->delete();
|
||||
}
|
||||
|
||||
$this->setBlock_Reason($reason);
|
||||
$this->save();
|
||||
|
|
|
@ -139,7 +139,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
|||
|
||||
if(!($res === IP::RL_RESET || $res === IP::RL_CANEXEC)) {
|
||||
if($res === IP::RL_BANNED && OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["rateLimits"]["autoban"]) {
|
||||
$this->user->identity->ban("Account has possibly been stolen");
|
||||
$this->user->identity->ban("Account has possibly been stolen", false);
|
||||
exit("Хакеры? Интересно...");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue