aboutsummaryrefslogtreecommitdiff
path: root/src/api/core/emergency_access.rs
diff options
context:
space:
mode:
authorStefan Melmuk <[email protected]>2023-02-01 23:10:09 +0100
committerStefan Melmuk <[email protected]>2023-02-01 23:10:09 +0100
commite65fbbfc2105566a3c457dd34d3ae790ce7f4fb5 (patch)
tree2d2bd1e46389b24bf39decbceb4253a34b70bff4 /src/api/core/emergency_access.rs
parent9366e3145231034040d7d2e0216070163d6d889f (diff)
downloadvaultwarden-e65fbbfc2105566a3c457dd34d3ae790ce7f4fb5.tar.gz
vaultwarden-e65fbbfc2105566a3c457dd34d3ae790ce7f4fb5.zip
don't nullify key when editing emergency access
the client does not send the key on every update of an emergency access contact so the field would be emptied on a change of the wait days or access level.
Diffstat (limited to 'src/api/core/emergency_access.rs')
-rw-r--r--src/api/core/emergency_access.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/api/core/emergency_access.rs b/src/api/core/emergency_access.rs
index fcabc617..90a5e6b8 100644
--- a/src/api/core/emergency_access.rs
+++ b/src/api/core/emergency_access.rs
@@ -123,7 +123,9 @@ async fn post_emergency_access(
emergency_access.atype = new_type;
emergency_access.wait_time_days = data.WaitTimeDays;
- emergency_access.key_encrypted = data.KeyEncrypted;
+ if data.KeyEncrypted.is_some() {
+ emergency_access.key_encrypted = data.KeyEncrypted;
+ }
emergency_access.save(&mut conn).await?;
Ok(Json(emergency_access.to_json()))