B
B
Bojczuk2016-06-22 15:07:44
Django
Bojczuk, 2016-06-22 15:07:44

Where to override the method returning the logged in user?

In the application, user session data is stored in the database, several custom classes were written for this logic before me.
Previously, when a user logged out or someone logged in from another device, the corresponding document was simply deleted from the database, and when the page was reloaded, the user was redirected to the login page.
At the moment, documents are not deleted, but the value is added to them active=False, respectively, when logging in from another device, the first user supposedly remains logged in anyway.
What method is responsible for checking the existence of session data in the database so that the application behaves as before, only looking not at the existence of the document, but at its parameter active? Can anyone come across?
I guess it might be indjango.contrib.sessions.backends.base.SessionBaseI will experiment.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
marazmiki, 2016-06-22
@Bojczuk

Make your own middleware that would check the value of the active flag for the current user and, if necessary, log him out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question