mirror of
https://github.com/nextcloud/passman.git
synced 2025-02-25 07:53:32 +08:00
Added credentiallistupdate to revision-restore
Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
parent
fce2fa835d
commit
fecdf5b409
1 changed files with 34 additions and 1 deletions
|
@ -133,14 +133,47 @@
|
||||||
|
|
||||||
//Used in activity
|
//Used in activity
|
||||||
_credential.revision_created = $filter('date')(_revision.created * 1000, "dd-MM-yyyy @ HH:mm:ss");
|
_credential.revision_created = $filter('date')(_revision.created * 1000, "dd-MM-yyyy @ HH:mm:ss");
|
||||||
CredentialService.updateCredential(_credential, (key)).then(function () {
|
CredentialService.updateCredential(_credential, (key)).then(function (restored_cred) {
|
||||||
SettingsService.setSetting('revision_credential', null);
|
SettingsService.setSetting('revision_credential', null);
|
||||||
$rootScope.$emit('app_menu', false);
|
$rootScope.$emit('app_menu', false);
|
||||||
$location.path('/vault/' + $routeParams.vault_id);
|
$location.path('/vault/' + $routeParams.vault_id);
|
||||||
NotificationService.showNotification($translate.instant('revision.restored'), 5000);
|
NotificationService.showNotification($translate.instant('revision.restored'), 5000);
|
||||||
|
|
||||||
|
$scope.updateExistingListWithCredential(restored_cred);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.updateExistingListWithCredential = function (credential) {
|
||||||
|
try {
|
||||||
|
if (!credential.shared_key) {
|
||||||
|
credential = CredentialService.decryptCredential(credential);
|
||||||
|
} else {
|
||||||
|
var enc_key = EncryptService.decryptString(credential.shared_key);
|
||||||
|
credential = ShareService.decryptSharedCredential(credential, enc_key);
|
||||||
|
}
|
||||||
|
credential.tags_raw = credential.tags;
|
||||||
|
|
||||||
|
|
||||||
|
var found=false;
|
||||||
|
var credList=$rootScope.vaultCache[$scope.active_vault.guid].credentials;
|
||||||
|
for (var i = 0; i < credList.length; i++) {
|
||||||
|
if (credList[i].credential_id === credential.credential_id) {
|
||||||
|
$rootScope.vaultCache[$scope.active_vault.guid].credentials[i]=credential;
|
||||||
|
found=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!found){
|
||||||
|
$rootScope.vaultCache[$scope.active_vault.guid].credentials.push(credential);
|
||||||
|
}
|
||||||
|
$rootScope.$broadcast('push_decrypted_credential_to_list', credential);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
NotificationService.showNotification($translate.instant('error.decrypt'), 5000);
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$scope.cancelRevision = function () {
|
$scope.cancelRevision = function () {
|
||||||
$location.path('/vault/' + $routeParams.vault_id);
|
$location.path('/vault/' + $routeParams.vault_id);
|
||||||
$scope.storedCredential = null;
|
$scope.storedCredential = null;
|
||||||
|
|
Loading…
Reference in a new issue