From 7005cee595ae74d6bd907ba0d2c6baf794ae72ce Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 8 Jun 2016 22:45:15 -0400 Subject: [PATCH] Added new favorite flag to sites. --- src/Vault/wwwroot/app/services/apiService.js | 1 + src/Vault/wwwroot/app/services/cipherService.js | 2 ++ src/Vault/wwwroot/app/services/importService.js | 2 ++ src/Vault/wwwroot/app/vault/vaultController.js | 4 +++- src/Vault/wwwroot/app/vault/views/vault.html | 2 +- src/Vault/wwwroot/app/vault/views/vaultAddSite.html | 6 ++++++ src/Vault/wwwroot/app/vault/views/vaultEditSite.html | 6 ++++++ 7 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Vault/wwwroot/app/services/apiService.js b/src/Vault/wwwroot/app/services/apiService.js index 6f4b0e0e96..3b72cd74f7 100644 --- a/src/Vault/wwwroot/app/services/apiService.js +++ b/src/Vault/wwwroot/app/services/apiService.js @@ -25,6 +25,7 @@ get: { method: 'GET', params: { id: '@id' } }, list: { method: 'GET', params: {} }, 'import': { url: _apiUri + '/ciphers/import', method: 'POST', params: {} }, + favorite: { url: _apiUri + '/ciphers/:id/favorite', method: 'PUT', params: { id: '@id' } }, del: { method: 'DELETE', params: { id: '@id' } } }); diff --git a/src/Vault/wwwroot/app/services/cipherService.js b/src/Vault/wwwroot/app/services/cipherService.js index 811041924a..b159569292 100644 --- a/src/Vault/wwwroot/app/services/cipherService.js +++ b/src/Vault/wwwroot/app/services/cipherService.js @@ -22,6 +22,7 @@ angular id: encryptedSite.Id, 'type': 1, folderId: encryptedSite.FolderId, + favorite: encryptedSite.Favorite, name: cryptoService.decrypt(encryptedSite.Name), uri: cryptoService.decrypt(encryptedSite.Uri), username: encryptedSite.Username && encryptedSite.Username !== '' ? cryptoService.decrypt(encryptedSite.Username) : null, @@ -77,6 +78,7 @@ angular id: unencryptedSite.id, 'type': 1, folderId: unencryptedSite.folderId === '' ? null : unencryptedSite.folderId, + favorite: unencryptedSite.favorite != null ? unencryptedSite.favorite : false, uri: cryptoService.encrypt(unencryptedSite.uri, key), name: cryptoService.encrypt(unencryptedSite.name, key), username: !unencryptedSite.username || unencryptedSite.username === '' ? null : cryptoService.encrypt(unencryptedSite.username, key), diff --git a/src/Vault/wwwroot/app/services/importService.js b/src/Vault/wwwroot/app/services/importService.js index 4c97b0696a..a3e6e30a8d 100644 --- a/src/Vault/wwwroot/app/services/importService.js +++ b/src/Vault/wwwroot/app/services/importService.js @@ -47,6 +47,7 @@ } sites.push({ + favorite: value.favorite != null ? value.favorite : false, uri: value.uri, username: value.username && value.username !== '' ? value.username : null, password: value.password, @@ -103,6 +104,7 @@ } sites.push({ + favorite: false, uri: value.url, username: value.username && value.username !== '' ? value.username : null, password: value.password, diff --git a/src/Vault/wwwroot/app/vault/vaultController.js b/src/Vault/wwwroot/app/vault/vaultController.js index 16ddc85031..1918d2bf1c 100644 --- a/src/Vault/wwwroot/app/vault/vaultController.js +++ b/src/Vault/wwwroot/app/vault/vaultController.js @@ -13,7 +13,8 @@ for (var i = 0; i < sites.Data.length; i++) { var decSite = { id: sites.Data[i].Id, - folderId: sites.Data[i].FolderId + folderId: sites.Data[i].FolderId, + favorite: sites.Data[i].Favorite }; try { decSite.name = cryptoService.decrypt(sites.Data[i].Name); } @@ -74,6 +75,7 @@ site[0].folderId = editedSite.folderId; site[0].name = editedSite.name; site[0].username = editedSite.username; + site[0].favorite = editedSite.favorite; } }); }; diff --git a/src/Vault/wwwroot/app/vault/views/vault.html b/src/Vault/wwwroot/app/vault/views/vault.html index 50f076f1eb..72c8454bda 100644 --- a/src/Vault/wwwroot/app/vault/views/vault.html +++ b/src/Vault/wwwroot/app/vault/views/vault.html @@ -46,7 +46,7 @@ - {{site.name}} + {{site.name}} {{site.username}} diff --git a/src/Vault/wwwroot/app/vault/views/vaultAddSite.html b/src/Vault/wwwroot/app/vault/views/vaultAddSite.html index 08e5ba5e40..228363c7dc 100644 --- a/src/Vault/wwwroot/app/vault/views/vaultAddSite.html +++ b/src/Vault/wwwroot/app/vault/views/vaultAddSite.html @@ -82,6 +82,12 @@ +
+ +
+
+ +