diff --git a/controller/credentialcontroller.php b/controller/credentialcontroller.php index 435e58b2..9e376b78 100644 --- a/controller/credentialcontroller.php +++ b/controller/credentialcontroller.php @@ -116,7 +116,7 @@ class CredentialController extends ApiController { 'delete_time' => $delete_time, 'hidden' => $hidden, 'otp' => $otp, - 'shared_key' => $shared_key, + 'shared_key' => ($shared_key) ? $shared_key : null, ); diff --git a/js/app/controllers/share.js b/js/app/controllers/share.js index bc0aec32..c79eea5d 100644 --- a/js/app/controllers/share.js +++ b/js/app/controllers/share.js @@ -9,7 +9,7 @@ * This file is part of passman, licensed under AGPLv3 */ angular.module('passmanApp') - .controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService) { + .controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', 'NotificationService', function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, NotificationService) { $scope.active_vault = VaultService.getActiveVault(); $scope.tabs = [{ @@ -60,7 +60,6 @@ angular.module('passmanApp') $location.path('/vault/' + $scope.storedCredential.vault_id); }; - console.log($location); $scope.share_link = $location.$$protocol + '://'+ $location.$$host + OC.generateUrl('apps/passman/share/public#') + $scope.storedCredential.guid; $scope.share_settings = { linkSharing:{ @@ -116,6 +115,16 @@ angular.module('passmanApp') } }; + $scope.unshareCredential = function(credential){ + ShareService.unshareCredential(credential).then(function(){ + var _credential = angular.copy(credential); + _credential.shared_key = null; + CredentialService.updateCredential(_credential).then(function () { + NotificationService.showNotification('Credential unshared', 4000) + }) + }) + } + $scope.applyShare = function(){ $scope.share_settings.cypher_progress.percent = 0; $scope.share_settings.cypher_progress.done = 0; diff --git a/js/templates.js b/js/templates.js index b7d797d9..61ed2d9a 100644 --- a/js/templates.js +++ b/js/templates.js @@ -107,7 +107,7 @@ angular.module('views/settings.html', []).run(['$templateCache', function($templ angular.module('views/share_credential.html', []).run(['$templateCache', function($templateCache) { 'use strict'; $templateCache.put('views/share_credential.html', - '