Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions app/lib/screens/change_pin_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ChangePinScreen extends StatefulWidget {
State<ChangePinScreen> createState() => _ChangePinScreenState();
}

enum _State { newPinWrong, newPin, confirm, done }
enum _State { newPinWrong, sameOldPin, newPin, confirm, done }

class _ChangePinScreenState extends State<ChangePinScreen> {
String newPin = '';
Expand All @@ -27,6 +27,8 @@ class _ChangePinScreenState extends State<ChangePinScreen> {
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:
Expand Down Expand Up @@ -57,8 +59,18 @@ class _ChangePinScreenState extends State<ChangePinScreen> {
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) {
Expand Down
3 changes: 2 additions & 1 deletion app/lib/screens/recover_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class _RecoverScreenState extends State<RecoverScreen> {

Map<String, dynamic> 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', '')}');
}
}

Expand Down