-
Notifications
You must be signed in to change notification settings - Fork 776
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
Reuse password option prompts again on a wrong password #4380
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, has anyone tested in manually?
I manually tested it and it worked for me. |
Just changed a match statement to if in 95518f6 |
@chong-he Found a bunch of edge cases not properly handled. Need to fix those |
Is there any update on this PR? It would be nice to fix #4364 |
After some testing, it was found that the PR requires a fix. Consider a scenario we have 2 keystore files with When we It also wouldn’t show whether the password is correct or not. It will then proceed to the fourth keystore, which it will now be able to detect the incorrect password and prompt again for the correct password. I attach a screenshot for reference. |
previous_password = Some(password.clone()); | ||
break Some(password); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current issue is that upon a reused password, after prompting the user to enter the password (line 177), it does not check whether the password is correct or not and proceed to the next keystore regardless. So I added a call to check_password_on_keystore
to check the password.
previous_password = Some(password.clone()); | |
break Some(password); | |
previous_password = Some(password.clone()); | |
if check_password_on_keystore(&keystore, &password)? { | |
break Some(password); | |
} |
The issue now is, because it becomes a nested if loop, the UX when the password is incorrect becomes:
Invalid password
at a first try, and then jumps to the beginning of the loop and display:
Invalid password
Reuse previous password.
Invalid password
Reused password incorrect. Retry!
and alternating that way until a correct password is entered. Do we have a better way for the UX? I try using a while loop but that's weird outcome too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in bd035f9
Thanks for catching it and testing the fix CK :)
@remyroy Sorry for the delay, this one went under the radar. Fixed the issues now. |
I have tested the feature and can confirm that it is working |
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 22ccdb6 |
* Prompt for password if incorrect in import * lint and fmt * Use if instead of match * Fix issue raised by @chong-he * Merge branch 'unstable' into reuse-pw-break * Remove unused function
* Prompt for password if incorrect in import * lint and fmt * Use if instead of match * Fix issue raised by @chong-he * Merge branch 'unstable' into reuse-pw-break * Remove unused function
Issue Addressed
Resolves #4364
Proposed Changes
Prompt the user to enter the password if the password is incorrect on using the
reuse-password
flag.This is useful when importing multiple keystores for which there are more than 1 passwords.
cc @remyroy