ыукмук мшвущ ашч

This commit is contained in:
2025-12-09 20:40:08 +09:00
parent a6b3c54534
commit 52abd9d1f7

View File

@@ -560,7 +560,7 @@ async def cleanup_inactive_sessions():
async def lifespan(app: FastAPI):
"""Управление жизненным циклом приложения"""
global rooms, clients, admin_sessions, client_websockets, admin_websockets
global video_queues, command_queues, room_stats, server_stats, stats_lock, cleanup_task, templates
global video_queues, command_queues, room_stats, server_stats, stats_lock, cleanup_task, templates, admin_frame_queues
import threading
stats_lock = threading.Lock()
@@ -660,11 +660,13 @@ async def login_form(request: Request, username: str = Form(...), password: str
"last_activity": datetime.now().isoformat(),
"is_authenticated": True
}
print(f"[Auth] ✓ Admin logged in: {username}, session_id={session_id[:16]}..., total sessions: {len(admin_sessions)}")
response = RedirectResponse(url="/dashboard", status_code=303)
response.set_cookie(key="session_id", value=session_id)
return response
print(f"[Auth] ❌ Failed login attempt: {username}")
server_host = get_server_host()
return templates.TemplateResponse("login.html", {
"request": request,