Restrict search to authorized users and add ratelimit

Searching is heavy, additional measures to prevent abuse must be taken.
This commit is contained in:
celestora 2022-04-04 15:10:30 +03:00 committed by Celestora
parent 0cd75a5a3d
commit 3281cd0c1b

View file

@ -25,6 +25,10 @@ final class SearchPresenter extends OpenVKPresenter
$type = $this->queryParam("type") ?? "users";
$page = (int) ($this->queryParam("p") ?? 1);
$this->willExecuteWriteAction();
if($query != "")
$this->assertUserLoggedIn();
// https://youtu.be/pSAWM5YuXx8
$repos = [ "groups" => "clubs", "users" => "users" ];