fix(auth): add visibility toggle to confirm password and update mismatch error message
This commit is contained in:
parent
6410d21e66
commit
7f8bd75c99
|
|
@ -500,7 +500,7 @@ export default function App() {
|
|||
return;
|
||||
}
|
||||
if (changeNewPassword !== changeConfirmPassword) {
|
||||
setChangePasswordError('New passwords do not match.');
|
||||
setChangePasswordError('Confirm password do not match.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ export const ProfileDrawer: React.FC<ProfileDrawerProps> = ({
|
|||
}) => {
|
||||
const [showOldPassword, setShowOldPassword] = useState(false);
|
||||
const [showNewPassword, setShowNewPassword] = useState(false);
|
||||
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
|
||||
const activeRule = getCountryRuleByName(profileCountry);
|
||||
|
||||
if (!isOpen || !loggedInUser) return null;
|
||||
|
|
@ -275,14 +276,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">
|
||||
|
|
|
|||
Loading…
Reference in New Issue