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
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-24 19:18:45 +04:00
1 parent 89ecb59a2a
commit 39a4d718a8
1 file changed
+2
+2
View File
@@ -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(