mirror of
https://github.com/nextcloud/passman.git
synced 2026-01-05 23:27:04 +08:00
Dislay of shared item (if user owns it) works
This commit is contained in:
parent
d6c85bffcc
commit
497198371e
3 changed files with 19 additions and 9 deletions
|
|
@ -39,7 +39,13 @@ angular.module('passmanApp')
|
|||
var _credentials = [];
|
||||
for (var i = 0; i < $scope.active_vault.credentials.length; i++) {
|
||||
try {
|
||||
$scope.active_vault.credentials[i] = CredentialService.decryptCredential(angular.copy(vault.credentials[i]));
|
||||
if(!$scope.active_vault.credentials[i].shared_key) {
|
||||
$scope.active_vault.credentials[i] = CredentialService.decryptCredential(angular.copy(vault.credentials[i]));
|
||||
|
||||
} else {
|
||||
var enc_key = EncryptService.decryptString(vault.credentials[i].shared_key);
|
||||
$scope.active_vault.credentials[i] = ShareService.decryptSharedCredential(angular.copy(vault.credentials[i]), enc_key);
|
||||
}
|
||||
$scope.active_vault.credentials[i].tags_raw = $scope.active_vault.credentials[i].tags;
|
||||
} catch (e) {
|
||||
NotificationService.showNotification('An error happend during decryption', 5000);
|
||||
|
|
@ -49,9 +55,8 @@ angular.module('passmanApp')
|
|||
$location.path('/')
|
||||
|
||||
}
|
||||
if ($scope.active_vault.credentials[i]) {
|
||||
if ($scope.active_vault.credentials[i].tags) {
|
||||
TagService.addTags($scope.active_vault.credentials[i].tags);
|
||||
|
||||
}
|
||||
}
|
||||
$scope.show_spinner = false;
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ angular.module('passmanApp')
|
|||
console.log(key);
|
||||
|
||||
var encryptedSharedCredential = ShareService.encryptSharedCredential($scope.storedCredential, key);
|
||||
CredentialService.updateCredential(encryptedSharedCredential);
|
||||
CredentialService.updateCredential(encryptedSharedCredential, true);
|
||||
|
||||
var list = $scope.share_settings.credentialSharedWithUserAndGroup;
|
||||
console.log(list);
|
||||
|
|
|
|||
|
|
@ -60,13 +60,18 @@ angular.module('passmanApp')
|
|||
getEncryptedFields: function () {
|
||||
return _encryptedFields;
|
||||
},
|
||||
updateCredential: function (credential) {
|
||||
updateCredential: function (credential, skipEncyption) {
|
||||
var _credential = angular.copy(credential);
|
||||
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));
|
||||
if(!skipEncyption){
|
||||
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));
|
||||
}
|
||||
} else {
|
||||
console.log('Skipping encryption')
|
||||
}
|
||||
|
||||
_credential.expire_time = new Date( angular.copy(credential.expire_time) ).getTime() / 1000;
|
||||
|
||||
var queryUrl = OC.generateUrl('apps/passman/api/v2/credentials/' + credential.credential_id);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue