diff options
author | brantje <brantje@gmail.com> | 2017-02-10 13:18:31 +0300 |
---|---|---|
committer | brantje <brantje@gmail.com> | 2017-02-13 19:29:29 +0300 |
commit | 0a386d77ceb4f978ee1a9ef996d4608971799f34 (patch) | |
tree | c207cc25632bff672794ecf5bb036f94fb849cfd /js/app/services/credentialservice.js | |
parent | 053a364d88c1a91c5f6e532a52c78adf3c3d9af7 (diff) |
Remove server side encryption setting at admin page.
Fix counting credentials (Fixes #235)
Fix for deleting shared credental (Fixes #232)
Fix for empty sharing keys in vaults (Fixes #230)
Fix removed shared credential leaves tags
Fix for lastpass import #233
Disable share button when link sharing is disabled.
Or when it's not shared with a user.
Add issue template
Bump version
Diffstat (limited to 'js/app/services/credentialservice.js')
-rw-r--r-- | js/app/services/credentialservice.js | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/js/app/services/credentialservice.js b/js/app/services/credentialservice.js index 6bc86fbd..77ebe7b1 100644 --- a/js/app/services/credentialservice.js +++ b/js/app/services/credentialservice.js @@ -82,13 +82,13 @@ getEncryptedFields: function () { return _encryptedFields; }, - updateCredential: function (credential, skipEncyption) { + updateCredential: function (credential, skipEncryption, key) { var _credential = angular.copy(credential); - if (!skipEncyption) { + if (!skipEncryption) { for (var i = 0; i < _encryptedFields.length; i++) { var field = _encryptedFields[i]; var fieldValue = angular.copy(credential[field]); - _credential[field] = EncryptService.encryptString(JSON.stringify(fieldValue)); + _credential[field] = EncryptService.encryptString(JSON.stringify(fieldValue), key); } } _credential.expire_time = new Date(angular.copy(credential.expire_time)).getTime() / 1000; @@ -150,6 +150,18 @@ } return credential; }, + getSharedKeyFromCredential: function (credential) { + var key = null; + if (!credential.hasOwnProperty('acl') && credential.hasOwnProperty('shared_key')) { + if (credential.shared_key) { + key = EncryptService.decryptString(angular.copy(credential.shared_key)); + } + } + if (credential.hasOwnProperty('acl')) { + key = EncryptService.decryptString(angular.copy(credential.acl.shared_key)); + } + return key; + }, getRevisions: function (guid) { var queryUrl = OC.generateUrl('apps/passman/api/v2/credentials/' + guid + '/revision'); return $http.get(queryUrl).then(function (response) { @@ -182,7 +194,7 @@ } }); }, - reencryptCredential: function (credential_guid, old_password, new_password) { + reencryptCredential: function (credential_guid, old_password, new_password, skipSharingKey) { var service = this; @@ -198,8 +210,7 @@ this.parent.plain_credential = service.decryptCredential(credential, this.parent.old_password); var tmp = angular.copy(this.parent.plain_credential); - //@FIXME Your shared credentials are not updated properly - if (tmp.hasOwnProperty('shared_key') && tmp.shared_key !== null) { + if (tmp.hasOwnProperty('shared_key') && tmp.shared_key !== null && !skipSharingKey) { var shared_key = EncryptService.decryptString(angular.copy(tmp.shared_key)).trim(); tmp.shared_key = EncryptService.encryptString(angular.copy(shared_key), this.parent.new_password); tmp.set_share_key = true; |