Skip to content

Commit 7a8b464

Browse files
authored
fix: updates username validation to allow for all special character usage (#9946)
### What? Previously, only `.` & `-` special chars were allowed in usernames ### How? Now - all special chars are accepted during username creating like `@`
1 parent d57cad6 commit 7a8b464

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/payload/src/fields/validations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ export const username: UsernameFieldValidation = (
232232
return t('validation:shorterThanMax', { maxLength })
233233
}
234234

235-
if ((value && !/^[\w.-]+$/.test(value)) || (!value && required)) {
236-
return t('validation:username')
235+
if (!value && required) {
236+
return t('validation:required')
237237
}
238238

239239
return true

0 commit comments

Comments
 (0)