Use a different password field to delete, since you need to unlock with a password and you might accidently click delete

This commit is contained in:
Mike Dilger 2023-01-09 19:02:59 +13:00
parent 31ba7530d2
commit 5167040480
2 changed files with 6 additions and 4 deletions

View File

@ -82,6 +82,7 @@ struct GossipUi {
follow_hex_pubkey: String, follow_hex_pubkey: String,
follow_pubkey_at_relay: String, follow_pubkey_at_relay: String,
password: String, password: String,
del_password: String,
import_priv: String, import_priv: String,
import_pub: String, import_pub: String,
replying_to: Option<Id>, replying_to: Option<Id>,
@ -152,6 +153,7 @@ impl GossipUi {
follow_hex_pubkey: "".to_owned(), follow_hex_pubkey: "".to_owned(),
follow_pubkey_at_relay: "".to_owned(), follow_pubkey_at_relay: "".to_owned(),
password: "".to_owned(), password: "".to_owned(),
del_password: "".to_owned(),
import_priv: "".to_owned(), import_priv: "".to_owned(),
import_pub: "".to_owned(), import_pub: "".to_owned(),
replying_to: None, replying_to: None,

View File

@ -251,20 +251,20 @@ fn offer_delete(app: &mut GossipUi, ui: &mut Ui) {
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.add_space(10.0); ui.add_space(10.0);
ui.label("Enter Password To Delete: "); ui.label("Enter Password To Delete: ");
ui.add(TextEdit::singleline(&mut app.password).password(true)); ui.add(TextEdit::singleline(&mut app.del_password).password(true));
}); });
if ui.button("DELETE (Cannot be undone!)").clicked() { if ui.button("DELETE (Cannot be undone!)").clicked() {
match GLOBALS match GLOBALS
.signer .signer
.blocking_write() .blocking_write()
.delete_identity(&app.password) .delete_identity(&app.del_password)
{ {
Ok(_) => *GLOBALS.status_message.blocking_write() = "Identity deleted.".to_string(), Ok(_) => *GLOBALS.status_message.blocking_write() = "Identity deleted.".to_string(),
Err(e) => *GLOBALS.status_message.blocking_write() = format!("{}", e), Err(e) => *GLOBALS.status_message.blocking_write() = format!("{}", e),
} }
app.password.zeroize(); app.del_password.zeroize();
app.password = "".to_owned(); app.del_password = "".to_owned();
} }
} }