User session tracking #93587

Merged
Oleg-Komarov merged 18 commits from user-session into main 2024-08-02 16:04:09 +02:00
2 changed files with 3 additions and 3 deletions
Showing only changes of commit 1f4e4db0d6 - Show all commits

View File

@ -689,5 +689,4 @@ class UserSession(models.Model):
def device(self):
if self.user_agent:
return user_agents.parse(self.user_agent)
else:
return None
return None

View File

@ -448,7 +448,8 @@ class ActiveSessionsView(LoginRequiredMixin, TemplateView):
class TerminateSessionView(LoginRequiredMixin, View):
def post(self, request, *args, **kwargs):
if user_session := self.request.user.sessions.filter(pk=kwargs.get('pk', 0)).first():
user_session_pk = kwargs.get('pk')
if user_session := self.request.user.sessions.filter(pk=user_session_pk).first():
user_session.session.delete()
user_session.delete()
return redirect('bid_main:active_sessions')