From 9bf77ec1c316b12da58a71e7594a7ee4d25fb56b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 24 Apr 2017 13:58:32 -0400 Subject: [PATCH] encrypt login with org key --- src/popup/app/vault/views/vault.html | 5 ++++- src/services/loginService.js | 17 +++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/popup/app/vault/views/vault.html b/src/popup/app/vault/views/vault.html index b02d2fc80e..4c80fcd083 100644 --- a/src/popup/app/vault/views/vault.html +++ b/src/popup/app/vault/views/vault.html @@ -46,7 +46,10 @@ data-clipboard-text="{{login.username}}" ng-class="{'disabled': !login.username}"> - {{login.name}} + + {{login.name}} + + {{login.username}} diff --git a/src/services/loginService.js b/src/services/loginService.js index f203b1cde0..5148f337ea 100644 --- a/src/services/loginService.js +++ b/src/services/loginService.js @@ -17,21 +17,26 @@ function initLoginService() { var model = { id: login.id, folderId: login.folderId, - favorite: login.favorite + favorite: login.favorite, + organizationId: login.organizationId }; - return cryptoService.encrypt(login.name).then(function (cs) { + var orgKey = null; + return cryptoService.getOrgKey(login.organizationId).then(function (key) { + orgKey = key; + return cryptoService.encrypt(login.name, orgKey); + }).then(function (cs) { model.name = cs; - return cryptoService.encrypt(login.uri); + return cryptoService.encrypt(login.uri, orgKey); }).then(function (cs) { model.uri = cs; - return cryptoService.encrypt(login.username); + return cryptoService.encrypt(login.username, orgKey); }).then(function (cs) { model.username = cs; - return cryptoService.encrypt(login.password); + return cryptoService.encrypt(login.password, orgKey); }).then(function (cs) { model.password = cs; - return cryptoService.encrypt(login.notes); + return cryptoService.encrypt(login.notes, orgKey); }).then(function (cs) { model.notes = cs; return model;