Verify e-mail

Verifying the address after sign-up in the sign-in card: a six-digit code that checks itself, resending it after a cooldown, and changing the address.

Open full screen

Inset · No navigation. <AppShell direction="inset">, the default: the navigation on the grey app frame, the page a raised white card inside it, scrolling within.

npx wideset add block-verify-email

Import the default export from @/blocks/wideset/verify-email. The files below are relative to your project's source directory.

Installed with this block
  • block-styles
  • button
  • form-field
  • text-input
  • toast
  • utils
blocks/wideset/verify-email/index.tsx
'use client';

import '@/styles/wideset-blocks.css';

import { ToastProvider } from '@/components/ui/wideset/toast/Toast.context';
import { useState } from 'react';

import { AuthCard } from './auth-card';
import { ROUTES } from './data';
import { EmailVerified } from './email-verified';
import { VerifyForm } from './verify-form';

/**
 * Verify e-mail, Inset direction with no navigation: the sign-in card after sign-up, asking for
 * the six-digit code sent to the new address, then saying it is verified.
 */
export default function VerifyEmail() {
  const [verified, setVerified] = useState(false);

  return (
    <ToastProvider position="bottom-center">
      <main className="ws-block-utility bg-ws-static-background p-ws-12 flex min-h-dvh items-center justify-center">
        <AuthCard
          other={{ href: ROUTES.signIn, label: 'Sign in' }}
          className="w-full max-w-[38.75rem]"
        >
          {verified ? <EmailVerified /> : <VerifyForm onVerified={() => setVerified(true)} />}
        </AuthCard>
      </main>
    </ToastProvider>
  );
}