Hello There is a project in which I would not want to allow users to open new tabs in other browsers and reauthorize on a resource. Those. A user should be logged in only from one tab. Is there any way to get all logged in users in Django at the current time? In order to do something like this:
all_login_users = ΠΠΎΠ»ΡΡΠΈΡΡ ΡΠΏΠΈΡΠΎΠΊ Π·Π°Π»ΠΎΠ³ΠΈΠ½Π΅Π½ΡΡ
ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Π΅ΠΉ Π½Π° ΡΠ΅ΠΊΡΡΠΈΠΉ ΠΌΠΎΠΌΠ΅Π½Ρ. If user in all_login_users: # ΠΡΠ»ΠΈ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ Π΅ΡΡΡ Π² ΡΠΏΠΈΡΠΊΠ΅ user.logout() # Π²ΡΡ
ΠΎΠ΄ΠΈΠΌ ΠΈΠ· Π²ΡΠ΅Ρ
Π²ΠΊΠ»Π°Π΄ΠΎΠΊ Π² ΠΊΠΎΡΠΎΡΡΡ
ΠΌΡ Π·Π°Π»ΠΎΠ³ΠΈΠ½ΠΈΠ»ΠΈΡΡ ΡΠ°Π½ΡΡΠ΅ user.login() # Π»ΠΎΠ³ΠΈΠ½ΠΈΠΌΡΡ ΠΏΠΎ Π½ΠΎΠ²ΠΎΠΉ. Maybe there are some other mechanisms for this implementation? Requires atomicity of user actions.