@@ -368,19 +368,20 @@ export function customDomainSchema (args) {
368
368
// Sub Branding validation schema
369
369
// sanitize the input for correct colors and text
370
370
export function subBrandingSchema ( args ) {
371
+ const hexRegex = / ^ # ( [ 0 - 9 a - f A - F ] { 6 } ) $ /
371
372
return object ( {
372
- title : string ( ) . max ( 100 , 'must be at most 100 characters' ) . matches ( / ^ [ a - z A - Z 0 - 9 \s ] + $ / , {
373
+ title : string ( ) . max ( 50 , 'must be at most 50 characters' ) . matches ( / ^ [ a - z A - Z 0 - 9 \s ] + $ / , {
373
374
message : 'title must only contain letters, numbers, and spaces'
374
375
} ) . nullable ( ) . trim ( ) ,
375
- description : string ( ) . max ( 250 , 'must be at most 250 characters' ) . matches ( / ^ [ a - z A - Z 0 - 9 \s ] + $ / , {
376
+ description : string ( ) . max ( 100 , 'must be at most 100 characters' ) . matches ( / ^ [ a - z A - Z 0 - 9 \s ] + $ / , {
376
377
message : 'description must only contain letters, numbers, and spaces'
377
378
} ) . nullable ( ) . trim ( ) ,
378
379
logoId : intValidator . nullable ( ) . positive ( 'must be positive' ) . integer ( 'must be an integer' ) ,
379
380
faviconId : intValidator . nullable ( ) . positive ( 'must be positive' ) . integer ( 'must be an integer' ) ,
380
- primaryColor : string ( ) . matches ( / ^ # ( [ 0 - 9 a - f A - F ] { 6 } ) $ / , {
381
+ primaryColor : string ( ) . matches ( hexRegex , {
381
382
message : 'primary color must be a valid hex color'
382
383
} ) . nullable ( ) ,
383
- secondaryColor : string ( ) . matches ( / ^ # ( [ 0 - 9 a - f A - F ] { 6 } ) $ / , {
384
+ secondaryColor : string ( ) . matches ( hexRegex , {
384
385
message : 'secondary color must be a valid hex color'
385
386
} ) . nullable ( )
386
387
} )
0 commit comments