diff --git a/apps/wallet/src/components/accounts/wizard/AccountConfigurationSettings.vue b/apps/wallet/src/components/accounts/wizard/AccountConfigurationSettings.vue index 71995023d..266a1bc35 100644 --- a/apps/wallet/src/components/accounts/wizard/AccountConfigurationSettings.vue +++ b/apps/wallet/src/components/accounts/wizard/AccountConfigurationSettings.vue @@ -25,14 +25,13 @@ :disabled="isViewMode || !!model.id" :multiple="true" /> - ModelValidatorResult { Ok(()) } +fn validate_account_name(name: &str) -> ModelValidatorResult { + if (name.len() < Account::NAME_RANGE.0 as usize) + || (name.len() > Account::NAME_RANGE.1 as usize) + { + return Err(AccountError::InvalidNameLength { + min_length: Account::NAME_RANGE.0, + max_length: Account::NAME_RANGE.1, + }); + } + + Ok(()) +} + impl ModelValidator for Account { fn validate(&self) -> ModelValidatorResult { self.metadata.validate()?; + validate_account_name(&self.name)?; + for asset in &self.assets { validate_asset_id(&asset.asset_id)?; } @@ -216,6 +231,7 @@ impl ModelValidator for Account { impl Account { pub const OWNERS_RANGE: (u8, u8) = (1, 10); pub const ADDRESS_RANGE: (u8, u8) = (1, 255); + pub const NAME_RANGE: (u8, u8) = (1, 64); pub const SYMBOL_RANGE: (u8, u8) = (1, 8); pub const MAX_POLICIES: u8 = 10;