Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pin] unlocked status is not updated as expected #10

Open
Sujana2422 opened this issue May 5, 2023 · 0 comments
Open

[Pin] unlocked status is not updated as expected #10

Sujana2422 opened this issue May 5, 2023 · 0 comments

Comments

@Sujana2422
Copy link

Hi Metro SDK Team,

While using Pin.unlocked() to check the status of PinDialog, it returns true even when the wrong pin was entered.

The issue can be reproduced with sdkTestApp by the following steps

  1. navigate to "Pin" and click on "show"
  2. enter "0000" and click "enter"
  3. click on "unlocked" and check the status on the console.
  4. again click on "show" and enter "1234"
  5. go back from the PinDialog by clicking backspace
  6. click on "unlocked" and check the status on the console.

Actual behaviour: Pin.unlocked() returns true even the wrong pin was entered
Expected behaviour: Pin.unlocked() should return false when the wrong pin was entered

Identified the issue at the below line,
https://github.com/Metrological/metrological-sdk/blob/master/src/Pin/index.js#L33

Before rejecting, the unlocked status should be updated to false as shown below.

let submit = pin => {
  return new Promise((resolve, reject) => {
    if (pin.toString() === Settings.get('platform', 'pin', '0000').toString()) {
      unlocked = true
      resolve(unlocked)
    } else {
      unlocked = false
      reject('Incorrect pin')
    }
  })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant