mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-22 06:28:39 +02:00
Merge branch 'master' into CWA-147-password-rename
This commit is contained in:
@@ -5349,7 +5349,7 @@ class $zh extends S {
|
||||
@override
|
||||
String get trade_state_timeout => "超时";
|
||||
@override
|
||||
String get nodes => "节点数";
|
||||
String get nodes => "节点";
|
||||
@override
|
||||
String get seed_share => "分享种子";
|
||||
@override
|
||||
|
||||
@@ -62,10 +62,16 @@ class _RestoreFromSeedFormState extends State<RestoreFromSeedForm> {
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: PrimaryButton(
|
||||
onPressed: () {
|
||||
walletRestorationStore.validateSeed(_seedKey.currentState.items);
|
||||
_seedKey.currentState.setErrorMessage(walletRestorationStore.errorMessage);
|
||||
|
||||
if (!walletRestorationStore.isValid) {
|
||||
_seedKey.currentState.invalidate();
|
||||
return;
|
||||
}
|
||||
|
||||
_seedKey.currentState.validated();
|
||||
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.restoreWalletFromSeedDetails,
|
||||
arguments: _seedKey.currentState.items);
|
||||
|
||||
@@ -72,7 +72,7 @@ abstract class NodeListBase with Store {
|
||||
|
||||
void validateNodeAddress(String value) {
|
||||
const pattern =
|
||||
'^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\$';
|
||||
'^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\$|^[0-9a-zA-Z.]+\$';
|
||||
final regExp = RegExp(pattern);
|
||||
isValid = regExp.hasMatch(value);
|
||||
errorMessage = isValid ? null : S.current.error_text_node_address;
|
||||
|
||||
@@ -76,13 +76,12 @@ abstract class WalleRestorationStoreBase with Store {
|
||||
@action
|
||||
void setSeed(List<MnemoticItem> seed) {
|
||||
this.seed = seed;
|
||||
validateSeed(seed);
|
||||
}
|
||||
|
||||
@action
|
||||
void validateSeed(List<MnemoticItem> seed) {
|
||||
final _seed = seed != null ? seed : this.seed;
|
||||
bool isValid = _seed.length == 25;
|
||||
bool isValid = _seed != null ? _seed.length == 25 : false;
|
||||
|
||||
if (!isValid) {
|
||||
errorMessage = S.current.wallet_restoration_store_incorrect_seed_length;
|
||||
|
||||
Reference in New Issue
Block a user