aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--migrations/mysql/2021-04-30-233251_add_reprompt/down.sql0
-rw-r--r--migrations/mysql/2021-04-30-233251_add_reprompt/up.sql2
-rw-r--r--migrations/postgresql/2021-04-30-233251_add_reprompt/down.sql0
-rw-r--r--migrations/postgresql/2021-04-30-233251_add_reprompt/up.sql2
-rw-r--r--migrations/sqlite/2021-04-30-233251_add_reprompt/down.sql0
-rw-r--r--migrations/sqlite/2021-04-30-233251_add_reprompt/up.sql2
-rw-r--r--src/api/core/ciphers.rs2
-rw-r--r--src/db/models/cipher.rs9
-rw-r--r--src/db/schemas/mysql/schema.rs1
-rw-r--r--src/db/schemas/postgresql/schema.rs1
-rw-r--r--src/db/schemas/sqlite/schema.rs1
11 files changed, 20 insertions, 0 deletions
diff --git a/migrations/mysql/2021-04-30-233251_add_reprompt/down.sql b/migrations/mysql/2021-04-30-233251_add_reprompt/down.sql
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/migrations/mysql/2021-04-30-233251_add_reprompt/down.sql
diff --git a/migrations/mysql/2021-04-30-233251_add_reprompt/up.sql b/migrations/mysql/2021-04-30-233251_add_reprompt/up.sql
new file mode 100644
index 00000000..a54e503c
--- /dev/null
+++ b/migrations/mysql/2021-04-30-233251_add_reprompt/up.sql
@@ -0,0 +1,2 @@
+ALTER TABLE ciphers
+ADD COLUMN reprompt INTEGER;
diff --git a/migrations/postgresql/2021-04-30-233251_add_reprompt/down.sql b/migrations/postgresql/2021-04-30-233251_add_reprompt/down.sql
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/migrations/postgresql/2021-04-30-233251_add_reprompt/down.sql
diff --git a/migrations/postgresql/2021-04-30-233251_add_reprompt/up.sql b/migrations/postgresql/2021-04-30-233251_add_reprompt/up.sql
new file mode 100644
index 00000000..a54e503c
--- /dev/null
+++ b/migrations/postgresql/2021-04-30-233251_add_reprompt/up.sql
@@ -0,0 +1,2 @@
+ALTER TABLE ciphers
+ADD COLUMN reprompt INTEGER;
diff --git a/migrations/sqlite/2021-04-30-233251_add_reprompt/down.sql b/migrations/sqlite/2021-04-30-233251_add_reprompt/down.sql
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/migrations/sqlite/2021-04-30-233251_add_reprompt/down.sql
diff --git a/migrations/sqlite/2021-04-30-233251_add_reprompt/up.sql b/migrations/sqlite/2021-04-30-233251_add_reprompt/up.sql
new file mode 100644
index 00000000..a54e503c
--- /dev/null
+++ b/migrations/sqlite/2021-04-30-233251_add_reprompt/up.sql
@@ -0,0 +1,2 @@
+ALTER TABLE ciphers
+ADD COLUMN reprompt INTEGER;
diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs
index 0f655f76..0e46a1d2 100644
--- a/src/api/core/ciphers.rs
+++ b/src/api/core/ciphers.rs
@@ -199,6 +199,7 @@ pub struct CipherData {
Identity: Option<Value>,
Favorite: Option<bool>,
+ Reprompt: Option<i32>,
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.data = type_data.to_string();
cipher.password_history = data.PasswordHistory.map(|f| f.to_string());
+ cipher.reprompt = data.Reprompt;
cipher.save(&conn)?;
cipher.move_to_folder(data.FolderId, &headers.user.uuid, &conn)?;
diff --git a/src/db/models/cipher.rs b/src/db/models/cipher.rs
index 09247c44..355efe68 100644
--- a/src/db/models/cipher.rs
+++ b/src/db/models/cipher.rs
@@ -38,9 +38,16 @@ db_object! {
pub password_history: Option<String>,
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
impl Cipher {
pub fn new(atype: i32, name: String) -> Self {
@@ -63,6 +70,7 @@ impl Cipher {
data: String::new(),
password_history: 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))),
"FolderId": self.get_folder_uuid(&user_uuid, conn),
"Favorite": self.is_favorite(&user_uuid, conn),
+ "Reprompt": self.reprompt.unwrap_or(RepromptType::None as i32),
"OrganizationId": self.organization_uuid,
"Attachments": attachments_json,
// We have UseTotp set to true by default within the Organization model.
diff --git a/src/db/schemas/mysql/schema.rs b/src/db/schemas/mysql/schema.rs
index 346b2959..b063549d 100644
--- a/src/db/schemas/mysql/schema.rs
+++ b/src/db/schemas/mysql/schema.rs
@@ -22,6 +22,7 @@ table! {
data -> Text,
password_history -> Nullable<Text>,
deleted_at -> Nullable<Datetime>,
+ reprompt -> Nullable<Integer>,
}
}
diff --git a/src/db/schemas/postgresql/schema.rs b/src/db/schemas/postgresql/schema.rs
index f8e1e9fe..09081c34 100644
--- a/src/db/schemas/postgresql/schema.rs
+++ b/src/db/schemas/postgresql/schema.rs
@@ -22,6 +22,7 @@ table! {
data -> Text,
password_history -> Nullable<Text>,
deleted_at -> Nullable<Timestamp>,
+ reprompt -> Nullable<Integer>,
}
}
diff --git a/src/db/schemas/sqlite/schema.rs b/src/db/schemas/sqlite/schema.rs
index f8e1e9fe..09081c34 100644
--- a/src/db/schemas/sqlite/schema.rs
+++ b/src/db/schemas/sqlite/schema.rs
@@ -22,6 +22,7 @@ table! {
data -> Text,
password_history -> Nullable<Text>,
deleted_at -> Nullable<Timestamp>,
+ reprompt -> Nullable<Integer>,
}
}