mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-23 06:38:35 +02:00
prevent using same wallet name as existing (#391)
* Add wallet name validation
This commit is contained in:
@@ -40,8 +40,3 @@ class TextValidator extends Validator<String> {
|
||||
|
||||
bool match(String value) => RegExp(pattern).hasMatch(value);
|
||||
}
|
||||
|
||||
class WalletNameValidator extends TextValidator {
|
||||
WalletNameValidator()
|
||||
: super(minLength: 1, maxLength: 15, pattern: '^[a-zA-Z0-9_]\$');
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/core/validator.dart';
|
||||
|
||||
class WalletNameValidator extends TextValidator {
|
||||
WalletNameValidator()
|
||||
: super(
|
||||
errorMessage: S.current.error_text_wallet_name,
|
||||
pattern: '^[a-zA-Z0-9\-_ ]+\$',
|
||||
minLength: 1,
|
||||
maxLength: 33);
|
||||
}
|
||||
Reference in New Issue
Block a user