mirror of
https://github.com/nextcloud/passman.git
synced 2025-10-10 05:25:51 +08:00
Unshare credentials
This commit is contained in:
parent
48b621a378
commit
3355db8d89
4 changed files with 14 additions and 4 deletions
|
@ -116,7 +116,7 @@ class CredentialController extends ApiController {
|
||||||
'delete_time' => $delete_time,
|
'delete_time' => $delete_time,
|
||||||
'hidden' => $hidden,
|
'hidden' => $hidden,
|
||||||
'otp' => $otp,
|
'otp' => $otp,
|
||||||
'shared_key' => $shared_key,
|
'shared_key' => ($shared_key) ? $shared_key : null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* This file is part of passman, licensed under AGPLv3
|
* This file is part of passman, licensed under AGPLv3
|
||||||
*/
|
*/
|
||||||
angular.module('passmanApp')
|
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.active_vault = VaultService.getActiveVault();
|
||||||
|
|
||||||
$scope.tabs = [{
|
$scope.tabs = [{
|
||||||
|
@ -60,7 +60,6 @@ angular.module('passmanApp')
|
||||||
$location.path('/vault/' + $scope.storedCredential.vault_id);
|
$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_link = $location.$$protocol + '://'+ $location.$$host + OC.generateUrl('apps/passman/share/public#') + $scope.storedCredential.guid;
|
||||||
$scope.share_settings = {
|
$scope.share_settings = {
|
||||||
linkSharing:{
|
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.applyShare = function(){
|
||||||
$scope.share_settings.cypher_progress.percent = 0;
|
$scope.share_settings.cypher_progress.percent = 0;
|
||||||
$scope.share_settings.cypher_progress.done = 0;
|
$scope.share_settings.cypher_progress.done = 0;
|
||||||
|
|
|
@ -107,7 +107,7 @@ angular.module('views/settings.html', []).run(['$templateCache', function($templ
|
||||||
angular.module('views/share_credential.html', []).run(['$templateCache', function($templateCache) {
|
angular.module('views/share_credential.html', []).run(['$templateCache', function($templateCache) {
|
||||||
'use strict';
|
'use strict';
|
||||||
$templateCache.put('views/share_credential.html',
|
$templateCache.put('views/share_credential.html',
|
||||||
'<div id="controls"><div class="actions creatable"><div class="breadcrumb"><div class="crumb svg ui-droppable" data-dir="/"><a ng-click="logout()"><i class="fa fa-home"></i></a></div><div class="crumb svg" data-dir="/Test"><a ng-click="cancel()">{{active_vault.name}}</a></div><div class="crumb svg last" data-dir="/Test"><a ng-if="storedCredential.credential_id">Share credential "{{storedCredential.label}}"</a></div></div></div></div><ul class="tab_header"><li ng-repeat="tab in tabs track by $index" class="tab" ng-class="{active:isActiveTab(tab)}" ng-click="onClickTab(tab)" use-theme>{{tab.title}}</li></ul><div class="tab_container edit_credential"><div ng-include="currentTab.url"></div><button ng-click="applyShare()">Share</button> <button ng-click="cancel()">Cancel</button></div>');
|
'<div id="controls"><div class="actions creatable"><div class="breadcrumb"><div class="crumb svg ui-droppable" data-dir="/"><a ng-click="logout()"><i class="fa fa-home"></i></a></div><div class="crumb svg" data-dir="/Test"><a ng-click="cancel()">{{active_vault.name}}</a></div><div class="crumb svg last" data-dir="/Test"><a ng-if="storedCredential.credential_id">Share credential "{{storedCredential.label}}"</a></div></div></div></div><ul class="tab_header"><li ng-repeat="tab in tabs track by $index" class="tab" ng-class="{active:isActiveTab(tab)}" ng-click="onClickTab(tab)" use-theme>{{tab.title}}</li></ul><div class="tab_container edit_credential"><div ng-include="currentTab.url"></div><button ng-click="applyShare()">Share</button> <button ng-click="cancel()">Cancel</button> <button class="btn btn-danger" ng-click="unshareCredential(storedCredential)">Unshare</button></div>');
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
angular.module('views/show_vault.html', []).run(['$templateCache', function($templateCache) {
|
angular.module('views/show_vault.html', []).run(['$templateCache', function($templateCache) {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
<button ng-click="applyShare()">Share</button>
|
<button ng-click="applyShare()">Share</button>
|
||||||
<button ng-click="cancel()">Cancel</button>
|
<button ng-click="cancel()">Cancel</button>
|
||||||
|
<button class="btn btn-danger" ng-click="unshareCredential(storedCredential)">Unshare</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue