User session tracking #93587
@ -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
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user