Auth Reset Password
hextaui/auth-reset-passwordFreeComponent
Reset password with strength indicator and token validation.
Install it
npx shadcn@latest add https://hextaui.com/r/auth-reset-password.jsonSource
1"use client";23import { CheckCircle2, Eye, EyeOff, Loader2, Lock } from "lucide-react";4import { useCallback, useMemo, useState } from "react";5import { cn } from "@/lib/utils";6import { Button } from "@/registry/new-york/ui/button";7import {8 Card,9 CardContent,10 CardDescription,11 CardHeader,12 CardTitle,13} from "@/registry/new-york/ui/card";14import {15 Field,16 FieldContent,17 FieldDescription,18 FieldError,19 FieldLabel,20} from "@/registry/new-york/ui/field";21import {22 InputGroup,23 InputGroupAddon,24 InputGroupButton,25 InputGroupInput,26} from "@/registry/new-york/ui/input-group";27import { Progress } from "@/registry/new-york/ui/progress";2829export interface PasswordStrength {30 score: number; // 0-431 feedback: string[];32}3334export interface AuthResetPasswordProps {35 token?: string;36 onSubmit?: (data: { password: string; token: string }) => void;37 onTokenValidate?: (token: string) => Promise<boolean>;38 className?: string;39 isLoading?: boolean;40 isTokenValid?: boolean;41 isTokenValidating?: boolean;42 errors?: {43 password?: string;44 confirmPassword?: string;45 token?: string;46 general?: string;47 };48}4950function calculatePasswordStrength(password: string): PasswordStrength {51 let score = 0;52 const feedback: string[] = [];5354 if (password.length >= 8) {55 score += 1;56 } else {57 feedback.push("At least 8 characters");58 }5960 if (/[a-z]/.test(password)) {61 score += 1;62 } else {63 feedback.push("One lowercase letter");64 }6566 if (/[A-Z]/.test(password)) {67 score += 1;68 } else {69 feedback.push("One uppercase letter");70 }7172 if (/\d/.test(password)) {73 score += 1;74 } else {75 feedback.push("One number");76 }7778 if (/[^a-zA-Z\d]/.test(password)) {79 score += 1;80 } else {81 feedback.push("One special character");82 }8384 return { score, feedback };85}8687function getStrengthLabel(score: number): string {88 if (score <= 1) return "Weak";89 if (score <= 2) return "Fair";90 if (score <= 3) return "Good";91 return "Strong";92}9394function validatePassword(value: string): string | undefined {95 if (!value) {96 return "Password is required";97 }98 if (value.length < 8) {99 return "Password must be at least 8 characters";100 }101 if (!/(?=.*[a-z])/.test(value)) {102 return "Password must contain at least one lowercase letter";103 }104 if (!/(?=.*[A-Z])/.test(value)) {105 return "Password must contain at least one uppercase letter";106 }107 if (!/(?=.*\d)/.test(value)) {108// … truncated
What it pulls in
Other registry items
Files it writes
More from HextaUI
All 139 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | HextaUI | Components | Free | 1 dep | |
| AI Chat Historyai-chat-history | HextaUI | Components | Free | no deps | |
| AI Citationsai-citations | HextaUI | Components | Free | no deps | |
| AI Conversationai-conversation | HextaUI | Components | Free | no deps | |
| AI Error Handlerai-error-handler | HextaUI | Components | Free | no deps | |
| AI File Uploadai-file-upload | HextaUI | Components | Free | no deps | |
| AI Messageai-message | HextaUI | Components | Free | 4 deps | |
| AI Model Selectorai-model-selector | HextaUI | Components | Free | no deps |
