fix: resolve signup watchlist review issues and auto-unlock on SIGNUP entry removal (#27923)

* fix: resolve signup watchlist review issues with deleteEntry, email verification ordering, and unlock flow

Co-Authored-By: [email protected] <[email protected]>

* fix: scope sendEmailVerification to non-invite signups only

Co-Authored-By: [email protected] <[email protected]>

* feat: auto-unlock users when SIGNUP-source watchlist entries are removed

Co-Authored-By: [email protected] <[email protected]>

* fix: remove PII from error logging in unlockSignupUser

Co-Authored-By: [email protected] <[email protected]>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-02-13 10:13:33 +00:00
1 parent 1bb4b206c6
commit 50c7210d6b
10 files changed
+542 -26

No files matched your search

@@ -12,8 +12,8 @@ import {
validateAndGetCorrectedUsernameForTeam,
} from "@calcom/features/auth/signup/utils/token";
import { validateAndGetCorrectedUsernameAndEmail } from "@calcom/features/auth/signup/utils/validateUsername";
import { getBillingProviderService } from "@calcom/features/ee/billing/di/containers/Billing";
import { getFeatureRepository } from "@calcom/features/di/containers/FeatureRepository";
import { getBillingProviderService } from "@calcom/features/ee/billing/di/containers/Billing";
import { UserRepository } from "@calcom/features/users/repositories/UserRepository";
import { GlobalWatchlistRepository } from "@calcom/features/watchlist/lib/repository/GlobalWatchlistRepository";
import { sentrySpan } from "@calcom/features/watchlist/lib/telemetry";
@@ -287,15 +287,6 @@ const handler: CustomNextApiHandler = async (body, usernameStatus, query) => {
if (process.env.AVATARAPI_USERNAME && process.env.AVATARAPI_PASSWORD) {
await prefillAvatar({ email });
}
// Only send verification email for non-premium usernames
// Premium usernames will get a magic link after payment in paymentCallback
if (!checkoutSessionId) {
sendEmailVerification({
email,
language: await getLocaleFromRequest(buildLegacyRequest(await headers(), await cookies())),
username: username || "",
});
}
}
const featureRepository = getFeatureRepository();
@@ -326,6 +317,14 @@ const handler: CustomNextApiHandler = async (body, usernameStatus, query) => {
);
}
if (!checkoutSessionId && !token) {
sendEmailVerification({
email,
language: await getLocaleFromRequest(buildLegacyRequest(await headers(), await cookies())),
username: username || "",
});
}
if (checkoutSessionId) {
console.log("Created user but missing payment", checkoutSessionId);
return NextResponse.json(