vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit e6b6d7f3a047dbe3caacb666e09bfd9f534b0c4a
parent 328cbade195324d8edbc7e532a17b4da77a08e26
Author: Daniel GarcĂ­a <dani1861994@hotmail.com>
Date:   Thu, 19 Apr 2018 17:54:56 +0200

Allow no folder when editing cipher

Diffstat:
Msrc/api/core/ciphers.rs | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs @@ -112,9 +112,9 @@ fn post_ciphers(data: Json<CipherData>, headers: Headers, conn: DbConn) -> JsonR Ok(Json(cipher.to_json(&headers.host, &conn))) } -fn update_cipher_from_data(cipher: &mut Cipher, data: CipherData, headers: &Headers, conn: &DbConn) -> EmptyResult { - if let Some(folder_id) = data.folderId { - match Folder::find_by_uuid(&folder_id, conn) { +fn update_cipher_from_data(cipher: &mut Cipher, data: CipherData, headers: &Headers, conn: &DbConn) -> EmptyResult { + if let Some(ref folder_id) = data.folderId { + match Folder::find_by_uuid(folder_id, conn) { Some(folder) => { if folder.user_uuid != headers.user.uuid { err!("Folder is not owned by user") @@ -122,10 +122,10 @@ fn update_cipher_from_data(cipher: &mut Cipher, data: CipherData, headers: &Head } None => err!("Folder doesn't exist") } - - cipher.folder_uuid = Some(folder_id); } + cipher.folder_uuid = data.folderId; + if let org_id @ Some(_) = data.organizationId { // TODO: Check if user in org cipher.organization_uuid = org_id;