diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-04-17 02:27:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-17 02:27:08 -0400 |
commit | e1116279484e24a3952056d04d7f6e0c6729340b (patch) | |
tree | 49ab7e4f2cc3c35fcbd84d653a0b7ca0a1e53b9f /src/bin/rbw/commands.rs | |
parent | 2ac44755bce30709abccd05210eb86ba1e18ce84 (diff) | |
parent | 1d7064f0f9751290ea4113b77f9cc55cf1743ab5 (diff) | |
download | rbw-e1116279484e24a3952056d04d7f6e0c6729340b.tar.gz rbw-e1116279484e24a3952056d04d7f6e0c6729340b.zip |
Merge pull request #53 from simias/dev/fixpassedit
Don't generate a password history entry for empty passwords
Diffstat (limited to 'src/bin/rbw/commands.rs')
-rw-r--r-- | src/bin/rbw/commands.rs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/bin/rbw/commands.rs b/src/bin/rbw/commands.rs index 2da06a2..1ceb409 100644 --- a/src/bin/rbw/commands.rs +++ b/src/bin/rbw/commands.rs @@ -850,14 +850,20 @@ pub fn edit( } => (username, password, uris, totp), _ => unreachable!(), }; - let new_history_entry = rbw::db::HistoryEntry { - last_used_date: format!( - "{}", - humantime::format_rfc3339(std::time::SystemTime::now()) - ), - password: entry_password.clone().unwrap_or_else(String::new), - }; - history.insert(0, new_history_entry); + + if let Some(prev_password) = entry_password.clone() { + let new_history_entry = rbw::db::HistoryEntry { + last_used_date: format!( + "{}", + humantime::format_rfc3339( + std::time::SystemTime::now() + ) + ), + password: prev_password, + }; + history.insert(0, new_history_entry); + } + let data = rbw::db::EntryData::Login { username: entry_username.clone(), password, |