add use_antispam_mechanism_for_not_logged_users config option

This commit is contained in:
2022-05-30 05:35:05 +02:00
parent 7d1fb3c04e
commit 01c10bad0e
4 changed files with 32 additions and 23 deletions

View File

@@ -499,19 +499,19 @@ void Functions::MakeFunction()
void Functions::CheckGetPostTimes(time_t difference)
{
time_t now = std::time(0);
if( !cur->session->puser && config->use_antispam_mechanism_for_not_logged_users )
{
time_t now = std::time(0);
if( cur->session->puser )
return;
if( cur->request->method != Request::post )
return;
if( now - cur->session->last_time_get >= (time_t)difference )
return;
if( cur->request->method != Request::post )
return;
if( now - cur->session->last_time_get >= (time_t)difference )
return;
cur->session->spam_score += 1;
log << log1 << "Functions: spam +1: POST after GET sent too fast" << logend;
cur->session->spam_score += 1;
log << log1 << "Functions: spam +1: POST after GET sent too fast" << logend;
}
}
@@ -519,7 +519,7 @@ void Functions::CheckGetPostTimes(time_t difference)
bool Functions::CheckAntispamCounter()
{
if( !cur->session->puser )
if( !cur->session->puser && config->use_antispam_mechanism_for_not_logged_users )
{
long form_id = Tol(cur->request->PostVar(L"winix_form_id"));
long counter_id = Tol(cur->request->PostVar(L"winix_form_counter"));