1
0
Fork 0

Merge pull request #1653 from jjlin/password-reprompt

Add support for password reprompt
Dieser Commit ist enthalten in:
Daniel García 2021-05-12 23:05:01 +02:00 committet von GitHub
Commit 746ce2afb4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
11 geänderte Dateien mit 20 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,2 @@
ALTER TABLE ciphers
ADD COLUMN reprompt INTEGER;

Datei anzeigen

@ -0,0 +1,2 @@
ALTER TABLE ciphers
ADD COLUMN reprompt INTEGER;

Datei anzeigen

@ -0,0 +1,2 @@
ALTER TABLE ciphers
ADD COLUMN reprompt INTEGER;

Datei anzeigen

@ -199,6 +199,7 @@ pub struct CipherData {
Identity: Option<Value>, Identity: Option<Value>,
Favorite: Option<bool>, Favorite: Option<bool>,
Reprompt: Option<i32>,
PasswordHistory: Option<Value>, PasswordHistory: Option<Value>,
@ -415,6 +416,7 @@ pub fn update_cipher_from_data(
cipher.fields = data.Fields.map(|f| _clean_cipher_data(f).to_string()); cipher.fields = data.Fields.map(|f| _clean_cipher_data(f).to_string());
cipher.data = type_data.to_string(); cipher.data = type_data.to_string();
cipher.password_history = data.PasswordHistory.map(|f| f.to_string()); cipher.password_history = data.PasswordHistory.map(|f| f.to_string());
cipher.reprompt = data.Reprompt;
cipher.save(&conn)?; cipher.save(&conn)?;
cipher.move_to_folder(data.FolderId, &headers.user.uuid, &conn)?; cipher.move_to_folder(data.FolderId, &headers.user.uuid, &conn)?;

Datei anzeigen

@ -38,9 +38,16 @@ db_object! {
pub password_history: Option<String>, pub password_history: Option<String>,
pub deleted_at: Option<NaiveDateTime>, pub deleted_at: Option<NaiveDateTime>,
pub reprompt: Option<i32>,
} }
} }
#[allow(dead_code)]
pub enum RepromptType {
None = 0,
Password = 1, // not currently used in server
}
/// Local methods /// Local methods
impl Cipher { impl Cipher {
pub fn new(atype: i32, name: String) -> Self { pub fn new(atype: i32, name: String) -> Self {
@ -63,6 +70,7 @@ impl Cipher {
data: String::new(), data: String::new(),
password_history: None, password_history: None,
deleted_at: None, deleted_at: None,
reprompt: None,
} }
} }
} }
@ -138,6 +146,7 @@ impl Cipher {
"DeletedDate": self.deleted_at.map_or(Value::Null, |d| Value::String(format_date(&d))), "DeletedDate": self.deleted_at.map_or(Value::Null, |d| Value::String(format_date(&d))),
"FolderId": self.get_folder_uuid(&user_uuid, conn), "FolderId": self.get_folder_uuid(&user_uuid, conn),
"Favorite": self.is_favorite(&user_uuid, conn), "Favorite": self.is_favorite(&user_uuid, conn),
"Reprompt": self.reprompt.unwrap_or(RepromptType::None as i32),
"OrganizationId": self.organization_uuid, "OrganizationId": self.organization_uuid,
"Attachments": attachments_json, "Attachments": attachments_json,
// We have UseTotp set to true by default within the Organization model. // We have UseTotp set to true by default within the Organization model.

Datei anzeigen

@ -22,6 +22,7 @@ table! {
data -> Text, data -> Text,
password_history -> Nullable<Text>, password_history -> Nullable<Text>,
deleted_at -> Nullable<Datetime>, deleted_at -> Nullable<Datetime>,
reprompt -> Nullable<Integer>,
} }
} }

Datei anzeigen

@ -22,6 +22,7 @@ table! {
data -> Text, data -> Text,
password_history -> Nullable<Text>, password_history -> Nullable<Text>,
deleted_at -> Nullable<Timestamp>, deleted_at -> Nullable<Timestamp>,
reprompt -> Nullable<Integer>,
} }
} }

Datei anzeigen

@ -22,6 +22,7 @@ table! {
data -> Text, data -> Text,
password_history -> Nullable<Text>, password_history -> Nullable<Text>,
deleted_at -> Nullable<Timestamp>, deleted_at -> Nullable<Timestamp>,
reprompt -> Nullable<Integer>,
} }
} }