feat(controlplane): verify email before cloud trial and enqueue welcome#2726
Open
mekilis wants to merge 4 commits into
Open
feat(controlplane): verify email before cloud trial and enqueue welcome#2726mekilis wants to merge 4 commits into
mekilis wants to merge 4 commits into
Conversation
Gate cloud StartTrial on DB-backed email_verified (OSS/self-hosted skip), fail-closed in the trial modal, and fire-and-forget Motunrayo welcome enqueue to Overwatch after cloud signup.
… oauth signups Changing the profile email now unverifies the account and reissues a verification token so the cloud trial gate cannot be passed with an unverified address. Google OAuth and new SSO registrations get the same onboarding welcome enqueue as password signups. Dashboard email_verified cache sync is centralized in PrivateService and drops the stale profile cache after verify.
RunBillingOrganisationSync stays the single owner of billing-org creation; the welcome enqueue no longer issues its own CreateOrganisation and instead retries briefly until the sync has created the org, with the Overwatch sweep as the named backfill on failure. Profile save now drops the cached profile so the verify chip refetches after an email change unverifies the account.
clearProfileDetailsCache now emits profileChanged, and the private shell subscribes to re-read the profile so the verify chip reflects an email change or verify without a full remount.
mekilis
force-pushed
the
feat/pde-917-918-onboarding-and-trial-verify
branch
from
July 18, 2026 07:24
e51931e to
6721006
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6721006. Configure here.
| u.User.EmailVerified = false | ||
| u.User.EmailVerificationToken = ulid.Make().String() | ||
| u.User.EmailVerificationExpiresAt = time.Now().Add(time.Hour * 2) | ||
| } |
There was a problem hiding this comment.
Email change can lock profile
High Severity
Changing email sets EmailVerified to false, but UpdateUserService still refuses any update when the user is unverified. A mistyped new address leaves the account unable to correct the email until that address is verified, which is impossible if the user does not control it.
Reviewed by Cursor Bugbot for commit 6721006. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
StartTrialfails closed when the authenticated user is not email-verified; OSS and self-hosted skip the gate (UsesOrgBilling()only).Test plan
POST …/subscriptions/trialreturns 403; modal CTA disabled until verify.ONBOARDING_EMAILS_MODE=enforce.go test ./api/handlers/ -run TestCloudTrialEmailVerifiedpasses (includes OSS skip case).Note
Medium Risk
Touches auth signup paths, billing trial gating, and profile email updates; changes are scoped with fail-open welcome and tests for the trial gate, but unverified users are newly blocked from cloud trials.
Overview
Cloud Start trial now fails closed unless the authenticated user has a verified email (OSS/self-hosted unchanged). The trial modal refreshes profile verification state, disables the CTA until verified, and shows guidance when not verified.
Email changes on profile update now clear verification, mint a new token, and queue a verification email so trial gating stays aligned with the current address. The dashboard invalidates cached profile/auth state after verify, profile save, and related flows.
After successful cloud signup (password register, new SSO registration, Google OAuth setup), a fail-open background job enqueues the Overwatch onboarding welcome via a new billing client method, with retries while async billing-org sync catches up. Registration/login responses are unchanged if welcome enqueue fails.
Reviewed by Cursor Bugbot for commit 6721006. Bugbot is set up for automated code reviews on this repo. Configure here.