From 39a4d718a826bb571d86fadd82c63b9f87e747b8 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Tue, 24 Nov 2026 16:18:45 +0100 Subject: [PATCH] feat: audit log names the account on sign-in and sign-up (#34664) Sign-in and sign-up entries in the audit log had an empty user, so nothing said whose account was involved. A password sign-in, a sign-up that signs the user in and the authenticator code step of two-factor sign-in now name the account in their entry. Failed sign-ins still have no user. Part of #33249 --- backend/open_webui/utils/auth.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/open_webui/utils/auth.py b/backend/open_webui/utils/auth.py index 881ab06db9..c86c5b7f63 100644 --- a/backend/open_webui/utils/auth.py +++ b/backend/open_webui/utils/auth.py @@ -722,6 +722,8 @@ async def create_session_response( raise HTTPException(409, 'Authentication changed. Please sign in again.') if is_mfa_required(source, await get_mfa_config()) and not mfa_verified: raise HTTPException(401, 'Authenticator verification is required.') + # Scope-backed, so outer middleware (audit) can reuse the resolved user + request.state.user = user expires_delta = parse_duration(await Config.get('auth.jwt_expiry')) expires_at = int(time.time()) + int(expires_delta.total_seconds()) if expires_delta else None token = create_token(