diff --git a/app/lib/screens/change_pin_screen.dart b/app/lib/screens/change_pin_screen.dart index 1e6c3d68c..37ac31d6e 100644 --- a/app/lib/screens/change_pin_screen.dart +++ b/app/lib/screens/change_pin_screen.dart @@ -13,7 +13,7 @@ class ChangePinScreen extends StatefulWidget { State createState() => _ChangePinScreenState(); } -enum _State { newPinWrong, newPin, confirm, done } +enum _State { newPinWrong, sameOldPin, newPin, confirm, done } class _ChangePinScreenState extends State { String newPin = ''; @@ -27,6 +27,8 @@ class _ChangePinScreenState extends State { switch (state) { case _State.newPinWrong: return 'Confirmation incorrect, please enter your new PIN'; + case _State.sameOldPin: + return "New PIN must not match the old one"; case _State.newPin: return 'Please enter your new PIN'; case _State.confirm: @@ -57,8 +59,18 @@ class _ChangePinScreenState extends State { switch (state) { case _State.newPinWrong: case _State.newPin: - newPin = enteredPinCode; - state = _State.confirm; + if (enteredPinCode == widget.currentPin) { + state = _State.sameOldPin; + } else { + newPin = enteredPinCode; + state = _State.confirm; + } + break; + case _State.sameOldPin: + if (enteredPinCode != widget.currentPin) { + newPin = enteredPinCode; + state = _State.confirm; + } break; case _State.confirm: if (newPin == enteredPinCode) { diff --git a/app/lib/screens/recover_screen.dart b/app/lib/screens/recover_screen.dart index b82968377..e3426cb79 100644 --- a/app/lib/screens/recover_screen.dart +++ b/app/lib/screens/recover_screen.dart @@ -45,7 +45,8 @@ class _RecoverScreenState extends State { Map body = json.decode(userInfoResult.body); if (body['publicKey'] != base64.encode(keyPair.publicKey)) { - throw Exception('Seed phrase does not match with ${doubleName.replaceAll('.3bot', '')}'); + throw Exception( + 'Seed phrase does not match with ${doubleName.replaceAll('.3bot', '')}'); } }