Step 3. A new password and its confirmation, with the rules ticked off as the user types.

Last updated

Open page
Show code
---
/**
 * Set new password: Step 3. A new password and its confirmation, with the rules ticked off as the user types.
 *
 * @page forgot-password
 */
import { Lock, ArrowLeft } from '@lucide/astro'
import AuthShell from '@/components/apogee/sections/AuthShell/AuthShell.astro'
import FeaturedIcon from '@/components/apogee/FeaturedIcon/FeaturedIcon.astro'
import Input from '@/components/apogee/Input/Input.astro'
import PasswordChecklist from '@/components/apogee/PasswordChecklist/PasswordChecklist.astro'
import Button from '@/components/apogee/Button/Button.astro'
---

<AuthShell heading="Set new password" description="Your new password must be different from the ones you used before." pattern="grid">
  <FeaturedIcon slot="brand" theme="outline" color="neutral" size="large"><Lock /></FeaturedIcon>

  <form method="post" class="flex flex-col gap-6">
    <div class="flex flex-col gap-3">
      <Input id="new-password" label="Password" type="password" name="password" placeholder="••••••••" autocomplete="new-password" minlength="8" required />
      <PasswordChecklist for="new-password" rules={[{ label: 'At least 8 characters', minLength: 8 }, { label: 'One special character', pattern: '[^A-Za-z0-9]' }]} />
      <Input id="confirm-password" label="Confirm password" type="password" name="password_confirm" placeholder="••••••••" autocomplete="new-password" required class="mt-2" />
      <PasswordChecklist for="confirm-password" rules={[{ label: 'Passwords match', match: 'new-password' }]} />
    </div>
    <Button type="submit" size="large" fullWidth>Reset password</Button>
  </form>

  <Button slot="footer" href="#" variant="ghost" color="neutral">
    <ArrowLeft slot="start" class="rtl:-scale-x-100" aria-hidden="true" />
    Back to log in
  </Button>
</AuthShell>

Add

npx @ava-ui/apogee add forgot-password/set-new-password

This copies the page to src/components/apogee/pages/forgot-password/ with everything it uses: AuthShell, Button, FeaturedIcon, Input, PasswordChecklist. Render it from one of your routes, or use Copy code above.

Accessibility

  • The page heading is the h1; the “Back to log in” arrow flips under right-to-left text.
  • The rules are part of the password field’s description, and the field stays invalid until they hold. The confirm field stays invalid until it matches. See PasswordChecklist.