diff --git a/controller/credentialcontroller.php b/controller/credentialcontroller.php index 22718bd3..d13ffd80 100644 --- a/controller/credentialcontroller.php +++ b/controller/credentialcontroller.php @@ -107,7 +107,7 @@ class CredentialController extends ApiController { $credential_id, $custom_fields, $delete_time, $description, $email, $expire_time, $favicon, $files, $guid, $hidden, $label, $otp, $password, $renew_interval, - $tags, $url, $username, $vault_id, $revision_created, $shared_key, $acl, $unshare_action) { + $tags, $url, $username, $vault_id, $revision_created, $shared_key, $acl, $unshare_action, $set_share_key) { $storedCredential = $this->credentialService->getCredentialById($credential_id, $this->userId); @@ -133,7 +133,6 @@ class CredentialController extends ApiController { 'delete_time' => $delete_time, 'hidden' => $hidden, 'otp' => $otp, - 'shared_key' => ($storedCredential->getSharedKey() === null) ? $shared_key : $storedCredential->getSharedKey(), ); @@ -218,10 +217,11 @@ class CredentialController extends ApiController { $link, $storedCredential->getUserId(), Activity::TYPE_ITEM_ACTION); } } - if($storedCredential->getSharedKey() === null){ + if($set_share_key == true){ $storedCredential->setSharedKey($shared_key); + $credential['shared_key'] = $shared_key; } - if($unshare_action){ + if($unshare_action == true){ $storedCredential->setSharedKey(''); $credential['shared_key'] = ''; } diff --git a/js/app/controllers/share.js b/js/app/controllers/share.js index e4234511..a181ed97 100644 --- a/js/app/controllers/share.js +++ b/js/app/controllers/share.js @@ -291,6 +291,7 @@ angular.module('passmanApp') ShareService.generateSharedKey(20).then(function (key) { var encryptedSharedCredential = ShareService.encryptSharedCredential($scope.storedCredential, key); + encryptedSharedCredential.set_share_key = true; CredentialService.updateCredential(encryptedSharedCredential, true).then(function (sharedCredential) { $scope.storedCredential = ShareService.decryptSharedCredential(sharedCredential, key); }); diff --git a/js/app/services/shareservice.js b/js/app/services/shareservice.js index d3bc68a0..64fe5b29 100644 --- a/js/app/services/shareservice.js +++ b/js/app/services/shareservice.js @@ -73,16 +73,7 @@ angular.module('passmanApp') return response.data; }) }, - - - getSharedCredentialRevisions: function (credential) { - var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/credential/'+ credential.guid +'/revisions'); - return $http.get(queryUrl).then(function (response) { - if (response.data) { - return response.data; - } - }); - }, + createPublicSharedCredential: function (shareObj) { var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/public'); return $http.post(queryUrl, shareObj).then(function (response) {