commit e65fbbfc2105566a3c457dd34d3ae790ce7f4fb5
parent 9366e3145231034040d7d2e0216070163d6d889f
Author: Stefan Melmuk <stefan.melmuk@gmail.com>
Date: Wed, 1 Feb 2023 23:10:09 +0100
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:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git 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()))