fix(task4): enforce unified password validation rule
This commit is contained in:
@@ -43,8 +43,8 @@ export function ChangePasswordModal({ open, onClose }: ChangePasswordModalProps)
|
||||
setErrorMsg("Please enter your current password.");
|
||||
return;
|
||||
}
|
||||
if (!newPassword || newPassword.length < 6) {
|
||||
setErrorMsg("New password must be at least 6 characters.");
|
||||
if (!newPassword || newPassword.length < 8) {
|
||||
setErrorMsg("New password must be at least 8 characters.");
|
||||
return;
|
||||
}
|
||||
if (newPassword !== confirmPassword) {
|
||||
@@ -73,7 +73,7 @@ export function ChangePasswordModal({ open, onClose }: ChangePasswordModalProps)
|
||||
if (!next) handleClose();
|
||||
}}
|
||||
title="Change Password"
|
||||
description="Update your account login password. Password must be at least 6 characters long."
|
||||
description="Update your account login password."
|
||||
className="max-w-md"
|
||||
>
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
@@ -122,9 +122,9 @@ export function ChangePasswordModal({ open, onClose }: ChangePasswordModalProps)
|
||||
value={newPassword}
|
||||
onChange={(e) => setNewPassword(e.target.value)}
|
||||
required
|
||||
minLength={6}
|
||||
minLength={8}
|
||||
autoComplete="new-password"
|
||||
placeholder="At least 6 characters"
|
||||
placeholder="At least 8 characters"
|
||||
className="w-full px-3 py-2 text-sm border border-gray-300 rounded-md pr-10 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
<button
|
||||
@@ -136,6 +136,7 @@ export function ChangePasswordModal({ open, onClose }: ChangePasswordModalProps)
|
||||
{showNew ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
|
||||
</button>
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 mt-1">At least 8 characters, with a letter and a number.</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
|
||||
Reference in New Issue
Block a user