diff --git a/packages/grid_client/src/helpers/validator.ts b/packages/grid_client/src/helpers/validator.ts index 2d6c5cb809..99f5a810ec 100644 --- a/packages/grid_client/src/helpers/validator.ts +++ b/packages/grid_client/src/helpers/validator.ts @@ -1,6 +1,7 @@ import { ValidationError } from "@threefold/types"; import { plainToInstance } from "class-transformer"; -import { validateSync } from "class-validator"; +import { buildMessage, registerDecorator, validateSync } from "class-validator"; +import { ValidationOptions as ClassValidatorValidationOptions } from "class-validator"; function validateObject(obj) { const errors = validateSync(obj); @@ -30,7 +31,26 @@ function validateHexSeed(seed: string, length: number): boolean { } return true; } - +function IsAlphanumericExpectUnderscore(validationOptions?: ClassValidatorValidationOptions) { + return function (object: any, propertyName: string) { + registerDecorator({ + name: "IsAlphanumericExpectUnderscore", + target: object.constructor, + propertyName: propertyName, + options: validationOptions, + constraints: [`${propertyName} must contain only letters, numbers, and underscores`], + validator: { + validate(value: any) { + return /^[a-zA-Z0-9_]*$/.test(value); + }, + defaultMessage: buildMessage( + eachPrefix => eachPrefix + "$property must contain only letters, numbers, and underscores", + validationOptions, + ), + }, + }); + }; +} interface ValidationOptions { props?: boolean | string | string[]; methods?: boolean | string | string[]; @@ -178,4 +198,11 @@ function _getMethods(ctor: any, options: Required): string[] return []; } -export { validateObject, validateInput, validateHexSeed, type ValidationOptions, ValidateMembers }; +export { + validateObject, + validateInput, + validateHexSeed, + type ValidationOptions, + ValidateMembers, + IsAlphanumericExpectUnderscore, +}; diff --git a/packages/grid_client/src/modules/models.ts b/packages/grid_client/src/modules/models.ts index 061724c00c..662eb13fee 100644 --- a/packages/grid_client/src/modules/models.ts +++ b/packages/grid_client/src/modules/models.ts @@ -20,10 +20,11 @@ import { ValidateNested, } from "class-validator"; +import { IsAlphanumericExpectUnderscore } from "../helpers"; import { Deployment } from "../zos/deployment"; import { ZdbModes } from "../zos/zdb"; import { blockchainType } from "./blockchainInterface"; -const NameLength = 15; +const NameLength = 50; const FarmNameLength = 40; enum ContractStates { @@ -97,11 +98,11 @@ class MyceliumNetworkModel { } class BaseGetDeleteModel { - @Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) name: string; + @Expose() @IsString() @IsNotEmpty() @IsAlphanumericExpectUnderscore() @MaxLength(NameLength) name: string; } class MachineModel { - @Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) name: string; + @Expose() @IsString() @IsNotEmpty() @MaxLength(NameLength) @IsAlphanumericExpectUnderscore() name: string; @Expose() @IsInt() @Min(1) node_id: number; @Expose() @IsOptional() @Type(() => DiskModel) @ValidateNested({ each: true }) disks?: DiskModel[]; @Expose() @IsOptional() @Type(() => QSFSDiskModel) @ValidateNested({ each: true }) qsfs_disks?: QSFSDiskModel[]; @@ -124,7 +125,7 @@ class MachineModel { } class MachinesModel { - @Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) name: string; + @Expose() @IsString() @IsNotEmpty() @IsAlphanumericExpectUnderscore() @MaxLength(NameLength) name: string; @Expose() @Type(() => NetworkModel) @ValidateNested() network: NetworkModel; @Expose() @Type(() => MachineModel) @ValidateNested({ each: true }) machines: MachineModel[]; @Expose() @IsString() @IsOptional() metadata?: string; @@ -137,7 +138,7 @@ class AddMachineModel extends MachineModel { } class DeleteMachineModel { - @Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) name: string; + @Expose() @IsString() @IsNotEmpty() @IsAlphanumericExpectUnderscore() @MaxLength(NameLength) name: string; @Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) deployment_name: string; } @@ -233,7 +234,7 @@ class QSFSZDBGetModel extends BaseGetDeleteModel {} class QSFSZDBDeleteModel extends BaseGetDeleteModel {} class BaseGatewayNameModel { - @Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength + 20) name: string; + @Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) name: string; } class GatewayFQDNModel extends BaseGatewayNameModel { @@ -340,7 +341,7 @@ class GetServiceContractModel { @Expose() @IsInt() @Min(1) serviceId: number; } class NameContractGetModel { - @Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength + 20) name: string; + @Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) name: string; } class NodeContractUpdateModel { diff --git a/packages/playground/src/components/caprover_worker.vue b/packages/playground/src/components/caprover_worker.vue index 6b3a05ea8a..86ebc8887b 100644 --- a/packages/playground/src/components/caprover_worker.vue +++ b/packages/playground/src/components/caprover_worker.vue @@ -4,10 +4,10 @@ :rules="[ validators.required('Name is required.'), validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" :value="$props.modelValue.name" #="{ props }" diff --git a/packages/playground/src/components/k8s_worker.vue b/packages/playground/src/components/k8s_worker.vue index 15a0cb3848..7451c1408c 100644 --- a/packages/playground/src/components/k8s_worker.vue +++ b/packages/playground/src/components/k8s_worker.vue @@ -8,7 +8,7 @@ name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.isAlphanumeric('Name should consist of alphabets & numbers only.'), validators.minLength('Name minimum length is 2 chars.', 2), - validators.maxLength('Name max length is 15 chars.', 15), + validators.maxLength('Name max length is 50 chars.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/components/manage_gateway_dialog.vue b/packages/playground/src/components/manage_gateway_dialog.vue index 3b619ec022..c9444d3fa2 100644 --- a/packages/playground/src/components/manage_gateway_dialog.vue +++ b/packages/playground/src/components/manage_gateway_dialog.vue @@ -122,7 +122,7 @@ validators.isAlphanumeric('Subdomain should consist of letters and numbers only.'), subdomain => validators.isAlpha('Subdomain must start with alphabet char.')(subdomain[0]), validators.minLength('Subdomain must be at least 4 characters.', 4), - subdomain => validators.maxLength('Subdomain cannot exceed 30 characters.', 30)(subdomain), + subdomain => validators.maxLength('Subdomain cannot exceed 50 characters.', 50)(subdomain), ]" :async-rules="gatewayTab === 1 ? [validateSubdomain] : []" #="{ props }" diff --git a/packages/playground/src/utils/validators.ts b/packages/playground/src/utils/validators.ts index d76d85130b..30fc932f3a 100644 --- a/packages/playground/src/utils/validators.ts +++ b/packages/playground/src/utils/validators.ts @@ -109,6 +109,14 @@ export function requiredTrue(msg: string) { }; } +export function IsAlphanumericExpectUnderscore(msg: string) { + return (value: string) => { + if (!/^[a-zA-Z0-9_]*$/.test(value)) { + return { message: msg, requiredTrue: true }; + } + }; +} + export function isAfter(msg: string, date?: string) { return (value: string) => { if (!validator.isAfter(value, date)) { diff --git a/packages/playground/src/weblets/freeflow.vue b/packages/playground/src/weblets/freeflow.vue index 4a53e60d29..6e4e213565 100644 --- a/packages/playground/src/weblets/freeflow.vue +++ b/packages/playground/src/weblets/freeflow.vue @@ -18,9 +18,9 @@ :value="threebotName" :rules="[ validators.required('Name is required.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), validators.minLength('Name must be at least 4 characters.', 4), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/full_vm.vue b/packages/playground/src/weblets/full_vm.vue index f726d1b523..56d7b86521 100644 --- a/packages/playground/src/weblets/full_vm.vue +++ b/packages/playground/src/weblets/full_vm.vue @@ -24,11 +24,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > @@ -106,7 +105,7 @@ name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Disk minLength is 2 chars.', 2), validators.isAlphanumeric('Disk name only accepts alphanumeric chars.'), - validators.maxLength('Disk maxLength is 15 chars.', 15), + validators.maxLength('Disk maxLength is 50 chars.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/micro_vm.vue b/packages/playground/src/weblets/micro_vm.vue index a6a7e8083e..436842d708 100644 --- a/packages/playground/src/weblets/micro_vm.vue +++ b/packages/playground/src/weblets/micro_vm.vue @@ -26,11 +26,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of alphabets & numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > @@ -132,7 +131,7 @@ }), validators.minLength('Disk minLength is 2 chars.', 2), validators.isAlphanumeric('Disk name only accepts alphanumeric chars.'), - validators.maxLength('Disk maxLength is 15 chars.', 15), + validators.maxLength('Disk maxLength is 50 chars.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_algorand.vue b/packages/playground/src/weblets/tf_algorand.vue index beaeff3a44..501c37522c 100644 --- a/packages/playground/src/weblets/tf_algorand.vue +++ b/packages/playground/src/weblets/tf_algorand.vue @@ -16,11 +16,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_casperlabs.vue b/packages/playground/src/weblets/tf_casperlabs.vue index d179e37837..8c78555b45 100644 --- a/packages/playground/src/weblets/tf_casperlabs.vue +++ b/packages/playground/src/weblets/tf_casperlabs.vue @@ -17,11 +17,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_discourse.vue b/packages/playground/src/weblets/tf_discourse.vue index e16db4d011..3f73d1aa4d 100644 --- a/packages/playground/src/weblets/tf_discourse.vue +++ b/packages/playground/src/weblets/tf_discourse.vue @@ -23,11 +23,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_funkwhale.vue b/packages/playground/src/weblets/tf_funkwhale.vue index bb34832fe0..0b5f4e3cf7 100644 --- a/packages/playground/src/weblets/tf_funkwhale.vue +++ b/packages/playground/src/weblets/tf_funkwhale.vue @@ -17,11 +17,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > @@ -38,7 +37,7 @@ validators.isAlphanumeric('Username should consist of letters and numbers only.'), username => validators.isAlpha('Username must start with alphabet char.')(username[0]), validators.minLength('Username must be at least 2 characters.', 2), - validators.maxLength('Username cannot exceed 15 characters.', 15), + validators.maxLength('Username cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_kubernetes.vue b/packages/playground/src/weblets/tf_kubernetes.vue index 53eb6fb3aa..15ae2e0b48 100644 --- a/packages/playground/src/weblets/tf_kubernetes.vue +++ b/packages/playground/src/weblets/tf_kubernetes.vue @@ -27,11 +27,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), - validators.isAlphanumeric('Name should consist of alphabets & numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), validators.minLength('Name minimum length is 2 chars.', 2), - validators.maxLength('Name max length is 15 chars.', 15), + validators.maxLength('Name max length is 50 chars.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_mattermost.vue b/packages/playground/src/weblets/tf_mattermost.vue index 69fc8b97b7..c091cd2455 100644 --- a/packages/playground/src/weblets/tf_mattermost.vue +++ b/packages/playground/src/weblets/tf_mattermost.vue @@ -24,11 +24,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_nextcloud.vue b/packages/playground/src/weblets/tf_nextcloud.vue index f7de9e86c8..2ea5c686dd 100644 --- a/packages/playground/src/weblets/tf_nextcloud.vue +++ b/packages/playground/src/weblets/tf_nextcloud.vue @@ -17,11 +17,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_node_pilot.vue b/packages/playground/src/weblets/tf_node_pilot.vue index 6e1c08fed1..85cf8484b6 100644 --- a/packages/playground/src/weblets/tf_node_pilot.vue +++ b/packages/playground/src/weblets/tf_node_pilot.vue @@ -16,8 +16,7 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), validators.maxLength('Name cannot exceed 15 characters.', 15), diff --git a/packages/playground/src/weblets/tf_nostr.vue b/packages/playground/src/weblets/tf_nostr.vue index 5bf6e16c99..1903ea9636 100644 --- a/packages/playground/src/weblets/tf_nostr.vue +++ b/packages/playground/src/weblets/tf_nostr.vue @@ -19,11 +19,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of alphabets & numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_owncloud.vue b/packages/playground/src/weblets/tf_owncloud.vue index 23ef8540be..6203a7605a 100644 --- a/packages/playground/src/weblets/tf_owncloud.vue +++ b/packages/playground/src/weblets/tf_owncloud.vue @@ -25,11 +25,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > @@ -42,7 +41,6 @@ :value="username" :rules="[ validators.required('Username is required.'), - validators.isLowercase('Username should consist of lowercase letters only.'), validators.isAlphanumeric('Username should consist of letters and numbers only.'), username => validators.isAlpha('Username must start with alphabet char.')(username[0]), validators.minLength('Username must be at least 2 characters.', 2), diff --git a/packages/playground/src/weblets/tf_peertube.vue b/packages/playground/src/weblets/tf_peertube.vue index a95363861d..7e8a895ee4 100644 --- a/packages/playground/src/weblets/tf_peertube.vue +++ b/packages/playground/src/weblets/tf_peertube.vue @@ -17,11 +17,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_presearch.vue b/packages/playground/src/weblets/tf_presearch.vue index a70bfe156b..de9501a054 100644 --- a/packages/playground/src/weblets/tf_presearch.vue +++ b/packages/playground/src/weblets/tf_presearch.vue @@ -29,11 +29,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_staticwebsite.vue b/packages/playground/src/weblets/tf_staticwebsite.vue index 3726eb052f..a1b3d2075f 100644 --- a/packages/playground/src/weblets/tf_staticwebsite.vue +++ b/packages/playground/src/weblets/tf_staticwebsite.vue @@ -17,11 +17,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_subsquid.vue b/packages/playground/src/weblets/tf_subsquid.vue index 3f5fbc8760..a1ad556add 100644 --- a/packages/playground/src/weblets/tf_subsquid.vue +++ b/packages/playground/src/weblets/tf_subsquid.vue @@ -17,11 +17,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_taiga.vue b/packages/playground/src/weblets/tf_taiga.vue index 983b5a81ce..82e5ff99a5 100644 --- a/packages/playground/src/weblets/tf_taiga.vue +++ b/packages/playground/src/weblets/tf_taiga.vue @@ -24,10 +24,10 @@ :rules="[ validators.required('Name is required.'), validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > @@ -44,7 +44,7 @@ validators.isAlphanumeric('Username should consist of letters and numbers only.'), username => validators.isAlpha('Username must start with alphabet char.')(username[0]), validators.minLength('Username must be at least 2 characters.', 2), - validators.maxLength('Username cannot exceed 15 characters.', 15), + validators.maxLength('Username cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_umbrel.vue b/packages/playground/src/weblets/tf_umbrel.vue index f26984736d..29d2e71d7c 100644 --- a/packages/playground/src/weblets/tf_umbrel.vue +++ b/packages/playground/src/weblets/tf_umbrel.vue @@ -17,11 +17,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tf_wordpress.vue b/packages/playground/src/weblets/tf_wordpress.vue index b57fdd649c..9786e915f6 100644 --- a/packages/playground/src/weblets/tf_wordpress.vue +++ b/packages/playground/src/weblets/tf_wordpress.vue @@ -17,11 +17,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of letters and numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" > diff --git a/packages/playground/src/weblets/tfrobot.vue b/packages/playground/src/weblets/tfrobot.vue index 2bb0bb2b5a..7ea7563c3d 100644 --- a/packages/playground/src/weblets/tfrobot.vue +++ b/packages/playground/src/weblets/tfrobot.vue @@ -26,11 +26,10 @@ :value="name" :rules="[ validators.required('Name is required.'), - validators.isLowercase('Name should consist of lowercase letters only.'), - validators.isAlphanumeric('Name should consist of alphabets & numbers only.'), + validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'), name => validators.isAlpha('Name must start with alphabet char.')(name[0]), validators.minLength('Name must be at least 2 characters.', 2), - validators.maxLength('Name cannot exceed 15 characters.', 15), + validators.maxLength('Name cannot exceed 50 characters.', 50), ]" #="{ props }" >