Skip to content

feat(email-verification): add EMAIL_UPDATE trigger support to resend flow #20186

@ratishjain12

Description

@ratishjain12

Problem

The resendEmailVerificationToken method in email-verification.service.ts hardcodes EmailVerificationTrigger.SIGN_UP when calling sendVerificationEmail().

While the sendVerificationEmail method already supports both SIGN_UP and EMAIL_UPDATE triggers (with different email subjects), the resend flow cannot differentiate between a signup verification resend and an email update verification resend.

Impact: When a user updates their email and requests a resend, they receive "Welcome to Twenty: Please Confirm Your Email" instead of "Please confirm your updated email" — incorrect branding and user confusion.

Root Cause

resendEmailVerificationToken (line 179) does not accept a verificationTrigger parameter:
await this.sendVerificationEmail({
  userId: user.id,
  email,
  workspace,
  locale,
  verificationTrigger: EmailVerificationTrigger.SIGN_UP, // hardcoded
});

Solution

  1. Add optional verificationTrigger field to ResendEmailVerificationTokenInput (default: SIGN_UP)
  2. Pass verificationTrigger from resolver to service
  3. Use the parameter in resendEmailVerificationToken instead of hardcoded value

Metadata

Metadata

Labels

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions