Support password history #155 (#156)

* Password History Support (#155)

* down.sql logic not required as per review comments
This commit is contained in:
Kumar Ankur
2018-08-28 02:38:58 +05:30
committed by Daniel García
parent b82710eecf
commit 781056152a
5 changed files with 16 additions and 0 deletions

View File

@ -32,6 +32,7 @@ pub struct Cipher {
pub data: String,
pub favorite: bool,
pub password_history: Option<String>,
}
/// Local methods
@ -55,6 +56,7 @@ impl Cipher {
fields: None,
data: String::new(),
password_history: None,
}
}
}
@ -77,6 +79,10 @@ impl Cipher {
let fields_json: JsonValue = if let Some(ref fields) = self.fields {
serde_json::from_str(fields).unwrap()
} else { JsonValue::Null };
let password_history_json: JsonValue = if let Some(ref password_history) = self.password_history {
serde_json::from_str(password_history).unwrap()
} else { JsonValue::Null };
let mut data_json: JsonValue = serde_json::from_str(&self.data).unwrap();
@ -108,6 +114,8 @@ impl Cipher {
"Object": "cipher",
"Edit": true,
"PasswordHistory": password_history_json,
});
let key = match self.type_ {