fix(auth): add visibility toggle to confirm password and update mismatch error message #101

Merged
amit merged 2 commits from fix/change-password-confirm-visibility-and-error into main 2026-11-16 05:21:49 +00:00
2 changed files with 19 additions and 9 deletions

View File

@ -542,7 +542,7 @@ export default function App() {
return;
}
if (changeNewPassword !== changeConfirmPassword) {
setChangePasswordError('New passwords do not match.');
setChangePasswordError('Confirm password do not match.');
return;
}

View File

@ -77,6 +77,7 @@ export const ProfileDrawer: React.FC<ProfileDrawerProps> = ({
}) => {
const [showOldPassword, setShowOldPassword] = useState(false);
const [showNewPassword, setShowNewPassword] = useState(false);
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
const parsed = parsePhoneNumber(profilePhone, profileCountry);
const [dialCode, setDialCode] = useState(parsed.dialCode);
@ -300,14 +301,23 @@ export const ProfileDrawer: React.FC<ProfileDrawerProps> = ({
<div className="space-y-1">
<label className="text-xs font-bold text-slate-500">Confirm New Password</label>
<input
type="password"
required
value={changeConfirmPassword}
onChange={(e) => setChangeConfirmPassword(e.target.value)}
placeholder="Repeat new password"
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs font-semibold text-slate-800 focus:outline-none focus:border-indigo-500"
/>
<div className="relative">
<input
type={showConfirmPassword ? 'text' : 'password'}
required
value={changeConfirmPassword}
onChange={(e) => setChangeConfirmPassword(e.target.value)}
placeholder="Repeat new password"
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 pr-10 text-xs font-semibold text-slate-800 focus:outline-none focus:border-indigo-500"
/>
<button
type="button"
onClick={() => setShowConfirmPassword(!showConfirmPassword)}
className="absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 p-0.5"
>
{showConfirmPassword ? <EyeOff className="h-3.5 w-3.5" /> : <Eye className="h-3.5 w-3.5" />}
</button>
</div>
</div>
<div className="flex flex-wrap gap-2 text-[10px] text-slate-500 pt-1">