File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -243,19 +243,23 @@ export const VALIDATION_USERNAME_OR_EMAIL = ({
243243} : {
244244 isRequired ?: boolean
245245} ) => ( {
246- format : ( value ) => {
246+ format : ( value : string ) => {
247247 if ( ! value ) return true
248248 if ( value . includes ( '@' ) ) {
249249 return email . $validator ( value , undefined , undefined )
250250 } else {
251251 return VALIDATION_FORMAT_SLUG ( value )
252252 }
253253 } ,
254- lengthMax : maxLength (
255- Math . min (
256- VALIDATION_USERNAME_LENGTH_MAXIMUM ,
257- VALIDATION_EMAIL_ADDRESS_LENGTH_MAXIMUM ,
258- ) ,
259- ) ,
254+ lengthMax : {
255+ $validator : ( value : string ) => {
256+ if ( ! value ) return true
257+ if ( value . includes ( '@' ) ) {
258+ return value . length <= VALIDATION_EMAIL_ADDRESS_LENGTH_MAXIMUM
259+ } else {
260+ return value . length <= VALIDATION_USERNAME_LENGTH_MAXIMUM
261+ }
262+ } ,
263+ } ,
260264 ...( isRequired ? { required } : { } ) ,
261265} )
You can’t perform that action at this time.
0 commit comments