V
V
vitaliyharchenko2016-07-29 09:52:25
Django
vitaliyharchenko, 2016-07-29 09:52:25

How to protect yourself from making a request while entering a url in the address bar?

The site has urls:
\login
\logout
In the process of entering the url "\login" into the address bar, letter by letter, the browser pulls the url "\logout" from the cache, automatically makes a request (for preloading chtoli?). A request arrives at the server and it is executed, as a result, the user is deauthorized.
Here is the view.py code:


def logout_view(request):
auth.logout(request)
return redirect('index_view')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2016-07-29
@sim3x

csrf will also relieve this pain

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question