MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / logout

Method logout

apps/accounts/api_views.py:184–201  ·  view source on GitHub ↗

Logs out the authenticated user

(self, request)

Source from the content-addressed store, hash-verified

182 description="Log out the current user",
183 )
184 def logout(self, request):
185 """Logs out the authenticated user"""
186 # Log logout event before actually logging out
187 from core.utils import log_system_event
188 username = request.user.username if request.user and request.user.is_authenticated else 'unknown'
189 client_ip = request.META.get('REMOTE_ADDR', 'unknown')
190 user_agent = request.META.get('HTTP_USER_AGENT', 'unknown')
191
192 log_system_event(
193 event_type='logout',
194 user=username,
195 client_ip=client_ip,
196 user_agent=user_agent,
197 )
198 logger.info(f"Logout: user={username} ip={client_ip}")
199
200 logout(request)
201 return Response({"message": "Logout successful"})
202
203
204# 🔹 2) User Management APIs

Callers

nothing calls this directly

Calls 2

log_system_eventFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected