Files
supabase/apps/studio/components/interfaces/SupportEmailVerification/SupportEmailVerification.tsx
barcofourie 85be44aab0 feat: adds verify support email page (#46331)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Feature. Adds a page to verify support email. This is part 4 of a 4 part
PR.

## What is the current behavior?


https://linear.app/supabase/issue/TOOLING-748/investigation-provide-support-option-for-users-unable-to-login

## What is the new behavior?

<img width="1505" height="853" alt="Screenshot 2026-05-25 at 10 19 24"
src="https://github.com/user-attachments/assets/98fb0c8a-ae25-46ba-b03a-f35861f6d136"
/>


## Additional context

Add any other context or screenshots.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added email verification flow. Users can verify addresses via
tokenized links and receive real-time feedback: loading state, success
confirmation, expired-link warning, and clear error messaging for
failures. A dedicated verification page and UI guide users through the
process.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46331?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-26 14:02:14 +02:00

81 lines
2.2 KiB
TypeScript

import { useParams } from 'common'
import { useEffect } from 'react'
import { Admonition, ShimmeringLoader } from 'ui-patterns'
import { InterstitialLayout, SupabaseLogo } from '@/components/layouts/InterstitialLayout'
import { useVerifyEmailMutation } from '@/data/support/support-email-verification-mutation'
export const SupportEmailVerification = () => {
const { token } = useParams()
const {
mutate: verifyEmail,
isPending,
isSuccess,
isError,
error,
} = useVerifyEmailMutation({ onError: () => {} })
useEffect(() => {
if (token) {
verifyEmail({ token })
}
}, [token, verifyEmail])
const isExpiredOrUsed = isError && error?.code === 410
const withLayout = (title: string, children: React.ReactNode) => (
<InterstitialLayout logo={<SupabaseLogo />} title={title}>
<div className="px-6 pb-6">{children}</div>
</InterstitialLayout>
)
if (!token) {
return withLayout(
'Email Verification',
<Admonition
type="warning"
description="No verification token was found. Please use the link from your email."
/>
)
}
if (isPending) {
return withLayout(
'Verifying your email…',
<div className="flex flex-col gap-3">
<ShimmeringLoader className="h-4 w-full py-0" />
<ShimmeringLoader className="h-4 w-3/4 py-0" />
</div>
)
}
if (isSuccess) {
return withLayout(
'Account linked',
<Admonition
type="success"
description="Thanks for verifying, our team now has the context they need to resolve your issue more efficiently. You can close this page."
/>
)
}
if (isExpiredOrUsed) {
return withLayout(
'Link no longer valid',
<Admonition
type="warning"
description="This verification link has already been used or has expired. You can close this page."
/>
)
}
return withLayout(
'Verification failed',
<Admonition
type="destructive"
description="We weren't able to verify your identity this time. Our team will still be in touch, verification just helps us view your organization and project details to resolve your issue more efficiently. You can close this page."
/>
)
}