-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Make password generator length use existing length if available #2318
Make password generator length use existing length if available #2318
Conversation
Thinking about it more, I don't really feel that the password generator widget keeping its last used length value as the in-memory equivalent of Instead I feel like it should it should:
This would mean that the standalone generator, the generator widget (on a new or passwordless entry), and the ini file are always consistent with each other. This behavior would be different from how keepassxc currently behaves (regardless of looking at password existing password length), however, I think it makes more sense than having the length that wasn't even used carry over into fresh entries. |
Edited PR description to reflect most recent commit. |
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.
Good point, agree
d9d65b7
to
9cf0b35
Compare
Add optional length parameter to PasswordGeneratorWidget::reset() (default=0), which when >0 sets the legth SpinBox's value to the value passed in. The EditEntryWidget already called reset() when the password was known, so the current length was just added to this call (accounts for empty passwords) If entry edit is cancelled, return the password generator length to the application default or last committed length if available. This is done by calling reseting the password generator in EditEntryWidget::cancel() when the edit page is being closed Fixes keepassxreboot#2180
9cf0b35
to
3eae419
Compare
Nice contribution! |
- New Database Wizard [#1952] - Advanced Search [#1797] - Automatic update checker [#2648] - KeeShare database synchronization [#2109, #1992, #2738, #2742, #2746, #2739] - Improve favicon fetching; transition to Duck-Duck-Go [#2795, #2011, #2439] - Remove KeePassHttp support [#1752] - CLI: output info to stderr for easier scripting [#2558] - CLI: Add --quiet option [#2507] - CLI: Add create command [#2540] - CLI: Add recursive listing of entries [#2345] - CLI: Fix stdin/stdout encoding on Windows [#2425] - SSH Agent: Support OpenSSH for Windows [#1994] - macOS: TouchID Quick Unlock [#1851] - macOS: Multiple improvements; include CLI in DMG [#2165, #2331, #2583] - Linux: Prevent Klipper from storing secrets in clipboard [#1969] - Linux: Use polling based file watching for NFS [#2171] - Linux: Enable use of browser plugin in Snap build [#2802] - TOTP QR Code Generator [#1167] - High-DPI Scaling for 4k screens [#2404] - Make keyboard shortcuts more consistent [#2431] - Warn user if deleting referenced entries [#1744] - Allow toolbar to be hidden and repositioned [#1819, #2357] - Increase max allowed database timeout to 12 hours [#2173] - Password generator uses existing password length by default [#2318] - Improve alert message box button labels [#2376] - Show message when a database merge makes no changes [#2551] - Browser Integration Enhancements [#1497, #2253, #1904, #2232, #1850, #2218, #2391, #2396, #2542, #2622, #2637, #2790] - Overall Code Improvements [#2316, #2284, #2351, #2402, #2410, #2419, #2422, #2443, #2491, #2506, #2610, #2667, #2709, #2731]
Description
Adds optional length parameter to
PasswordGeneratorWidget::reset()
(default=0), which when >0 sets the length SpinBox's value to the value passed in. The EditEntryWidget already called reset() when the password at a time when was known, so the current length was just added to this call (accounts for empty passwords correctly)This seems like a clean approach to me, as the use of the default parameter keeps all previous usage the same, except when a value is passed in. Another approach could be to add a public
PasswordGeneratorWidget::setLength()
function. If that is more desired, I would be happy to do that instead.Edit: Additionally, I made the change discussed in my comment below. Now, if the entry edit is closed without saving, any changes to the password generator length will not carry over into new entries.
Motivation and context
Fixes #2180
Fixes undesirable behavior discussed in comments of #2318
How has this been tested?
[generator]->Length
to something recognizableIt is the last used length (in this case 8). This is identical to the current behavior, happy to change it if another behavior is desired:The length is still the value of[generator]->Length
I then cancelled this entry (this is important for the next step).
[generator]->Length
at startup.The generator widget always retains its last state in memory, since it is always just hidden and shown. It does not actually commit its length to the ini until a generated password is actually used, therefore the standalone generator will not inherit the last used value of a cancelled generation.Types of changes
Checklist:
-DWITH_ASAN=ON
. [REQUIRED]