Skip to content

Commit dc3f312

Browse files
authored
feat: add comprehensive validation for full name field (#1359)
1 parent 231cb12 commit dc3f312

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • web/lib/react/components/organization/user

web/lib/react/components/organization/user/update.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ import { createConnectQueryKey } from '@connectrpc/connect-query';
2020
const generalSchema = yup
2121
.object({
2222
avatar: yup.string().optional(),
23-
title: yup.string().required('Name is required'),
23+
title: yup
24+
.string()
25+
.required('Name is required')
26+
.min(2, 'Name must be at least 2 characters')
27+
.matches(
28+
/^[a-zA-Z\s'-]+$/,
29+
'Name can only contain letters, spaces, hyphens, and apostrophes'
30+
),
2431
email: yup.string().email().required()
2532
})
2633
.required();

0 commit comments

Comments
 (0)