gate: fix password_reset RLS policy for crm_auth, set tenant context before token creation

This commit is contained in:
Agent Zero
2026-07-31 09:24:04 +02:00
parent 437c107ee8
commit 9d7b160e2a
+4
View File
@@ -240,6 +240,10 @@ class AuthService:
for prev_token in prev_result.scalars().all():
prev_token.used_at = datetime.now(UTC)
# Set tenant context for RLS (auth session uses crm_auth role)
from app.core.db import set_tenant_context
await set_tenant_context(db, user_tenant.tenant_id)
# Create new token
import secrets