Add password confirmation to team member creation form
All checks were successful
Deploy / deploy (push) Successful in 11s
All checks were successful
Deploy / deploy (push) Successful in 11s
Shows confirm password field when a password is entered. Validates match before saving. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,8 @@ export default function TeamMemberPanel({ member, isEditingSelf, onClose, onSave
|
|||||||
const [saving, setSaving] = useState(false)
|
const [saving, setSaving] = useState(false)
|
||||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
|
||||||
const [showBrandsDropdown, setShowBrandsDropdown] = useState(false)
|
const [showBrandsDropdown, setShowBrandsDropdown] = useState(false)
|
||||||
|
const [confirmPassword, setConfirmPassword] = useState('')
|
||||||
|
const [passwordError, setPasswordError] = useState('')
|
||||||
const brandsDropdownRef = useRef(null)
|
const brandsDropdownRef = useRef(null)
|
||||||
|
|
||||||
// Workload state (loaded internally)
|
// Workload state (loaded internally)
|
||||||
@@ -59,6 +61,8 @@ export default function TeamMemberPanel({ member, isEditingSelf, onClose, onSave
|
|||||||
team_ids: Array.isArray(member.teams) ? member.teams.map(t => t.id) : [],
|
team_ids: Array.isArray(member.teams) ? member.teams.map(t => t.id) : [],
|
||||||
})
|
})
|
||||||
setDirty(isCreateMode)
|
setDirty(isCreateMode)
|
||||||
|
setConfirmPassword('')
|
||||||
|
setPasswordError('')
|
||||||
if (!isCreateMode) loadWorkload()
|
if (!isCreateMode) loadWorkload()
|
||||||
}
|
}
|
||||||
}, [member])
|
}, [member])
|
||||||
@@ -108,6 +112,11 @@ export default function TeamMemberPanel({ member, isEditingSelf, onClose, onSave
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
|
setPasswordError('')
|
||||||
|
if (isCreateMode && form.password && form.password !== confirmPassword) {
|
||||||
|
setPasswordError('Passwords do not match')
|
||||||
|
return
|
||||||
|
}
|
||||||
setSaving(true)
|
setSaving(true)
|
||||||
try {
|
try {
|
||||||
await onSave(isCreateMode ? null : memberId, {
|
await onSave(isCreateMode ? null : memberId, {
|
||||||
@@ -204,6 +213,22 @@ export default function TeamMemberPanel({ member, isEditingSelf, onClose, onSave
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{isCreateMode && form.password && (
|
||||||
|
<div>
|
||||||
|
<label className="block text-xs font-medium text-text-tertiary mb-1">Confirm Password</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
value={confirmPassword}
|
||||||
|
onChange={e => { setConfirmPassword(e.target.value); setPasswordError('') }}
|
||||||
|
className="w-full px-3 py-2 text-sm border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-brand-primary/20 focus:border-brand-primary"
|
||||||
|
placeholder="••••••••"
|
||||||
|
/>
|
||||||
|
{passwordError && (
|
||||||
|
<p className="text-xs text-red-500 mt-1">{passwordError}</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user