From 96c94f1797be34a64db3c4c03aa25a88c1a82cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Moreno?= Date: Fri, 18 Aug 2017 17:52:36 +0200 Subject: [PATCH] Removing existing secrets before creating a new one --- src/app.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index 947998d1..0a20a1a0 100644 --- a/src/app.rs +++ b/src/app.rs @@ -147,7 +147,15 @@ impl AppOp { let ss = SecretService::new(EncryptionType::Dh)?; let collection = ss.get_default_collection()?; - //create new item + // deleting previous items + let allpass = collection.get_all_items()?; + let passwds = allpass.iter() + .filter(|x| x.get_label().unwrap_or(String::from("")) == "guillotine"); + for p in passwds { + p.delete()?; + } + + // create new item collection.create_item( "guillotine", // label vec![