diff --git a/controller/credentialcontroller.php b/controller/credentialcontroller.php
index b6fcb60f..22718bd3 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) {
+ $tags, $url, $username, $vault_id, $revision_created, $shared_key, $acl, $unshare_action) {
$storedCredential = $this->credentialService->getCredentialById($credential_id, $this->userId);
@@ -221,6 +221,10 @@ class CredentialController extends ApiController {
if($storedCredential->getSharedKey() === null){
$storedCredential->setSharedKey($shared_key);
}
+ if($unshare_action){
+ $storedCredential->setSharedKey('');
+ $credential['shared_key'] = '';
+ }
$this->credentialRevisionService->createRevision($storedCredential, $storedCredential->getUserId(), $credential_id, $this->userId);
$credential = $this->credentialService->updateCredential($credential);
diff --git a/js/app/controllers/share.js b/js/app/controllers/share.js
index 69d546ae..6bdfeb58 100644
--- a/js/app/controllers/share.js
+++ b/js/app/controllers/share.js
@@ -180,7 +180,9 @@ angular.module('passmanApp')
$scope.unshareCredential = function (credential) {
ShareService.unshareCredential(credential);
var _credential = angular.copy(credential);
+ var enc_key = EncryptService.decryptString(angular.copy(_credential.shared_key));
_credential.shared_key = null;
+ _credential.unshare_action = true;
CredentialService.updateCredential(_credential).then(function () {
NotificationService.showNotification('Credential unshared', 4000)
});
@@ -189,11 +191,22 @@ angular.module('passmanApp')
var _file = $scope.storedCredential.files[f];
FileService.getFile(_file).then(function (fileData) {
//Decrypt with old key
- fileData.filename = EncryptService.decryptString(fileData.filename);
+ fileData.filename = EncryptService.decryptString(fileData.filename, enc_key);
fileData.file_data = EncryptService.decryptString(fileData.file_data);
FileService.updateFile(fileData, $scope.active_vault.vaultKey);
})
}
+
+ CredentialService.getRevisions($scope.storedCredential.guid).then(function (revisions) {
+ for (var r = 0; r < revisions.length; r++) {
+ var _revision = revisions[r];
+ //Decrypt!
+ _revision.credential_data = ShareService.decryptSharedCredential(_revision.credential_data, enc_key);
+ _revision.credential_data = CredentialService.encryptCredential(_revision.credential_data);
+ console.log('Used key for encrypting history ', enc_key);
+ CredentialService.updateRevision(_revision);
+ }
+ });
};
/**
diff --git a/js/templates.js b/js/templates.js
index bfa0c737..35325dfd 100644
--- a/js/templates.js
+++ b/js/templates.js
@@ -113,7 +113,7 @@ angular.module('views/share_credential.html', []).run(['$templateCache', functio
angular.module('views/show_vault.html', []).run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('views/show_vault.html',
- '
{{filtered_credentials}} {{ ::credential.label}} {{ ::tag.text}} |
');
+ '{{filtered_credentials}} {{ ::credential.label}} {{ ::tag.text}} |
');
}]);
angular.module('views/vaults.html', []).run(['$templateCache', function($templateCache) {
diff --git a/templates/views/show_vault.html b/templates/views/show_vault.html
index a83ed8e8..95a63de2 100644
--- a/templates/views/show_vault.html
+++ b/templates/views/show_vault.html
@@ -74,7 +74,7 @@
-
+
{{ ::credential.label}}