fix: address PR review comments on enroll and verify email

- Revert org-site layout 404 bypass; custom domain org lookup uses hostname
- Remove unnecessary comment in enroll redirect helper
- Restore email verification flow documentation
- Use generic welcome copy when no org branding is resolved

Co-authored-by: Rotimi Best <[email protected]>
This commit is contained in:
Cursor Agent
2026-07-10 04:51:30 +00:00
co-authored by Rotimi Best
parent a6d06f356f
commit 5de1f51e76
4 changed files with 25 additions and 13 deletions
@@ -11,10 +11,28 @@ type ChangeEmailConfirmationOptions = Parameters<
NonNullable<NonNullable<NonNullable<BetterAuthOptions['user']>['changeEmail']>['sendChangeEmailConfirmation']>
>[0];
/**
* Email verification flow.
*
* 1. user says I want to change my email from [email protected] to [email protected]
* 2. we send an email to [email protected] asking user to verify if they really want to change their email to [email protected] `sendChangeEmailConfirmation()`. [better-auth].
* 3. user clicks the link in the email
* 4. we update the email in the database. [better-auth].
* 5. we send a confirmation email to [email protected] `sendVerificationEmail()`. [dashboard].
* 6. user clicks the link in the email
* 7. we mark [email protected] as verified. [better-auth].
*/
function stripTriggerParam(url: string): string {
return url.replace('trigger=app', '').replace('trigger%3Dapp', '');
}
/**
* Brands verification mail with the org from `resolveVerificationOrg` (callback URL
* host/?org=, self-hosted first org, then the user's first membership). When no
* org applies — e.g. dashboard signup before onboarding creates an org — copy
* and masthead fall back to ClassroomIO defaults.
*/
async function sendOrgAwareVerifyEmail(options: {
to: string;
verificationUrl: string;