mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +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");
|
if($deleteSubscriptions) {
|
||||||
$subs = $subs->where(
|
$subs = DatabaseConnection::i()->getContext()->table("subscriptions");
|
||||||
"follower = ? OR (target = ? AND model = ?)",
|
$subs = $subs->where(
|
||||||
$this->getId(),
|
"follower = ? OR (target = ? AND model = ?)",
|
||||||
$this->getId(),
|
$this->getId(),
|
||||||
get_class($this),
|
$this->getId(),
|
||||||
);
|
get_class($this),
|
||||||
$subs->delete();
|
);
|
||||||
|
$subs->delete();
|
||||||
|
}
|
||||||
|
|
||||||
$this->setBlock_Reason($reason);
|
$this->setBlock_Reason($reason);
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
|
@ -139,7 +139,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
|
|
||||||
if(!($res === IP::RL_RESET || $res === IP::RL_CANEXEC)) {
|
if(!($res === IP::RL_RESET || $res === IP::RL_CANEXEC)) {
|
||||||
if($res === IP::RL_BANNED && OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["rateLimits"]["autoban"]) {
|
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("Хакеры? Интересно...");
|
exit("Хакеры? Интересно...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue