M
M
Maga Izdaga2021-07-09 20:58:17
Django
Maga Izdaga, 2021-07-09 20:58:17

How to implement a captcha usage system for a certain number of requests from one person?

I'm making my site and at the moment where requests are made to the server, I would like that with each certain number of requests, users will be given a captcha to confirm that they are people. I have never done this and I don’t even know how to ask such a question to the browser and found my own way of implementing it - through sessions. That is, I wrote that in sessions, with each POST request, the POST request counter increased by 1 and if, for example, 3 requests came from one user, then he is given a captcha field along with the form, this works, but this data is stored in the user's cookie and it turns out that when the cookie is cleared, the request counter is reset to zero and, it turns out, my system is crashing. I don’t know, maybe I chose the right solution, but if something else is used for such purposes, then write, or throw a guide or, if I still fell for the right solution,

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Lashchevsky, 2021-07-09
@MagaVTanke

Write on the server side to the database or anywhere the IP from which the request is coming, the number of attempts and the date of the last request, and look at these entries. If there is an entry from the IP address of the user in the database with an exceeded number of errors lately - give a captcha.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question