From 1a9f57bb3970f27cb3659e6b44c9787330215772 Mon Sep 17 00:00:00 2001 From: Pushpanjali Verma <141740169+pushpanjalii@users.noreply.github.com> Date: Sun, 19 Oct 2025 00:37:52 +0530 Subject: [PATCH] Add PasswordGenerator component for password management --- app/api/(auth)/changePassword/route.ts | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/app/api/(auth)/changePassword/route.ts b/app/api/(auth)/changePassword/route.ts index ebea934..da449f5 100644 --- a/app/api/(auth)/changePassword/route.ts +++ b/app/api/(auth)/changePassword/route.ts @@ -61,3 +61,60 @@ export async function POST(req: NextRequest) { ); } } + +function PasswordGenerator() { + const [password, setPassword] = useState(""); + const [showPassword, setShowPassword] = useState(false); + + const generatePassword = () => { + const length = 12; + const chars = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+"; + let pass = ""; + for (let i = 0; i < length; i++) { + pass += chars.charAt(Math.floor(Math.random() * chars.length)); + } + setPassword(pass); + }; + + const copyToClipboard = () => { + navigator.clipboard.writeText(password); + alert("Password copied!"); + }; + + return ( +
+ +
+ + + + +
+
+ ); +} + +export default PasswordGenerator;