mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
Merge pull request #9 from cake-tech/CWA-152-seed-validation-bug
CWA-152 | fixed bug
This commit is contained in:
commit
fa8f01328b
2 changed files with 7 additions and 2 deletions
|
@ -62,10 +62,16 @@ class _RestoreFromSeedFormState extends State<RestoreFromSeedForm> {
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: PrimaryButton(
|
child: PrimaryButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
walletRestorationStore.validateSeed(_seedKey.currentState.items);
|
||||||
|
_seedKey.currentState.setErrorMessage(walletRestorationStore.errorMessage);
|
||||||
|
|
||||||
if (!walletRestorationStore.isValid) {
|
if (!walletRestorationStore.isValid) {
|
||||||
|
_seedKey.currentState.invalidate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_seedKey.currentState.validated();
|
||||||
|
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
Routes.restoreWalletFromSeedDetails,
|
Routes.restoreWalletFromSeedDetails,
|
||||||
arguments: _seedKey.currentState.items);
|
arguments: _seedKey.currentState.items);
|
||||||
|
|
|
@ -76,13 +76,12 @@ abstract class WalleRestorationStoreBase with Store {
|
||||||
@action
|
@action
|
||||||
void setSeed(List<MnemoticItem> seed) {
|
void setSeed(List<MnemoticItem> seed) {
|
||||||
this.seed = seed;
|
this.seed = seed;
|
||||||
validateSeed(seed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void validateSeed(List<MnemoticItem> seed) {
|
void validateSeed(List<MnemoticItem> seed) {
|
||||||
final _seed = seed != null ? seed : this.seed;
|
final _seed = seed != null ? seed : this.seed;
|
||||||
bool isValid = _seed.length == 25;
|
bool isValid = _seed != null ? _seed.length == 25 : false;
|
||||||
|
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
errorMessage = S.current.wallet_restoration_store_incorrect_seed_length;
|
errorMessage = S.current.wallet_restoration_store_incorrect_seed_length;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue