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
@@ -1,18 +1,11 @@
import { PUBLIC_ORG_SITE_LIGHT_MODE_ROUTES } from '$lib/utils/constants/routes';
import { error } from '@sveltejs/kit';
function canResolveOrgFromCoursePath(pathname: string): boolean {
return PUBLIC_ORG_SITE_LIGHT_MODE_ROUTES.some((pattern) => new RegExp(pattern).test(pathname));
}
export const load = async ({ parent, url }) => {
export const load = async ({ parent }) => {
const { org, isOrgSite } = await parent();
// An org-site subdomain that doesn't resolve to a real org must 404 rather
// than fall back to whatever org a requested course happens to belong to.
// Course landing/enroll pages can still resolve org context from the course
// slug when the host lookup fails (e.g. custom domain with a backend port).
if (isOrgSite && !org && !canResolveOrgFromCoursePath(url.pathname)) {
if (isOrgSite && !org) {
throw error(404, 'Organization not found');
}
@@ -28,8 +28,6 @@
const isEmailVerified = $derived(Boolean($profile.isEmailVerified || sessionUser?.emailVerified));
function resolvePostEnrollRedirect(): string {
// Org-site enrollments are always students — the API's `/courses/:id/lessons`
// target is the admin course editor and 404s or blocks students on custom domains.
return '/lms';
}