Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore: send verification email to users without an organization (#91615)

Alex Liderdcf990f2da70
diff --git a/posthog/tasks/email.py b/posthog/tasks/email.py
index 701238754a49..8ec760231907 100644
--- a/posthog/tasks/email.py
+++ b/posthog/tasks/email.py
@@ -595,7 +595,7 @@ def send_email_verification(
posthoganalytics.capture(
distinct_id=str(user.distinct_id),
event="verification email sent",
- groups={"organization": str(user.current_organization.id)}, # type: ignore
+ groups={"organization": str(user.current_organization.id)} if user.current_organization else None,
)
@@ -629,7 +629,7 @@ def send_email_verification_code(user_id: int, code: str, target_email: str | No
capture(
distinct_id=str(user.distinct_id),
event="verification code sent",
- groups={"organization": str(user.current_organization.id)}, # type: ignore
+ groups={"organization": str(user.current_organization.id)} if user.current_organization else None,
)
@@ -656,7 +656,7 @@ def send_code_based_verification(user_id: int, code: str) -> None:
posthoganalytics.capture(
distinct_id=str(user.distinct_id),
event="login verification code sent",
- groups={"organization": str(user.current_organization.id)}, # type: ignore
+ groups={"organization": str(user.current_organization.id)} if user.current_organization else None,
)