diff options
author | Stefan Melmuk <[email protected]> | 2023-02-01 23:10:09 +0100 |
---|---|---|
committer | Stefan Melmuk <[email protected]> | 2023-02-01 23:10:09 +0100 |
commit | e65fbbfc2105566a3c457dd34d3ae790ce7f4fb5 (patch) | |
tree | 2d2bd1e46389b24bf39decbceb4253a34b70bff4 /src/api/core/emergency_access.rs | |
parent | 9366e3145231034040d7d2e0216070163d6d889f (diff) | |
download | vaultwarden-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.rs | 4 |
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())) |