From b1d401ae9d100782ef47acc1c77135840ded7965 Mon Sep 17 00:00:00 2001 From: catmoreak Date: Fri, 1 Aug 2025 22:49:13 +0530 Subject: [PATCH] feat: add password visibility toggle to auth pages --- client/src/components/PasswordInput.jsx | 76 +++++++++++++++++++++++++ client/src/pages/LoginPage.jsx | 8 +-- client/src/pages/ResetPassword.jsx | 13 ++--- client/src/pages/SignupPage.jsx | 10 ++-- 4 files changed, 88 insertions(+), 19 deletions(-) create mode 100644 client/src/components/PasswordInput.jsx diff --git a/client/src/components/PasswordInput.jsx b/client/src/components/PasswordInput.jsx new file mode 100644 index 00000000..b3e10dd6 --- /dev/null +++ b/client/src/components/PasswordInput.jsx @@ -0,0 +1,76 @@ +import React, { useState } from 'react'; + +const PasswordInput = ({ + value, + onChange, + placeholder = "Password", + name = "password", + required = true, + className = "p-3 border border-gray-300 rounded text-gray-900 placeholder-gray-400" +}) => { + const [showPassword, setShowPassword] = useState(false); + + const togglePasswordVisibility = () => { + setShowPassword(!showPassword); + }; + + return ( +
+ + +
+ ); +}; + +export default PasswordInput; diff --git a/client/src/pages/LoginPage.jsx b/client/src/pages/LoginPage.jsx index 7a0e93f5..3c99a686 100644 --- a/client/src/pages/LoginPage.jsx +++ b/client/src/pages/LoginPage.jsx @@ -1,5 +1,6 @@ import React, { useState } from "react"; import { useNavigate, Link } from "react-router-dom"; +import PasswordInput from "../components/PasswordInput"; function LoginPage() { const navigate = useNavigate(); @@ -57,13 +58,10 @@ function LoginPage() { required className="p-3 border border-gray-300 rounded text-gray-900 placeholder-gray-400" /> - setPassword(e.target.value)} - required - className="p-3 border border-gray-300 rounded text-gray-900 placeholder-gray-400" + placeholder="Password" /> {error &&

{error}

}