Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorFelix Nüsse <Felix.nuesse@t-online.de>2018-11-23 20:15:18 +0300
committerfnuesse <felix.nuesse@t-online.de>2018-11-23 22:07:17 +0300
commitea23930352037553d75dc25ca9de47a1ce12ad69 (patch)
tree841d358a9fe1d31525b8460f3454e2ff6f133dcb /js
parentabaedc1e38ccbbaac182b04437cdb4741e6c852a (diff)
Added proper returnvalue to updatemethod of credentials and add the resulting value to the list if it does not exist or replace it if it exists
Fixed Nullpointer on listadd Signed-off-by: Felix Nüsse <Felix.nuesse@t-online.de>
Diffstat (limited to 'js')
-rw-r--r--js/app/controllers/credential.js1
-rw-r--r--js/app/controllers/edit_credential.js20
2 files changed, 16 insertions, 5 deletions
diff --git a/js/app/controllers/credential.js b/js/app/controllers/credential.js
index f6d445c1..cb82461d 100644
--- a/js/app/controllers/credential.js
+++ b/js/app/controllers/credential.js
@@ -319,7 +319,6 @@
};
$rootScope.$on('push_decrypted_credential_to_list', function () {
- $scope.active_vault = $rootScope.vaultCache[$scope.active_vault.guid];
$rootScope.$broadcast('credentials_loaded');
});
diff --git a/js/app/controllers/edit_credential.js b/js/app/controllers/edit_credential.js
index 14acc04c..0cfaff6a 100644
--- a/js/app/controllers/edit_credential.js
+++ b/js/app/controllers/edit_credential.js
@@ -317,8 +317,6 @@
$location.path('/vault/' + $routeParams.vault_id);
NotificationService.showNotification($translate.instant('credential.created'), 5000);
- console.log("new cred");
- console.log(new_cred);
$scope.updateExistingListWithCredential(new_cred);
});
@@ -349,11 +347,13 @@
if(_credential.description && _credential.description !== "") {
_credential.description = _credential.description.replace(regex, "");
}
- CredentialService.updateCredential(_credential, _useKey).then(function () {
+ CredentialService.updateCredential(_credential, _useKey).then(function (updated_cred) {
$scope.saving = false;
SettingsService.setSetting('edit_credential', null);
$location.path('/vault/' + $routeParams.vault_id);
NotificationService.showNotification($translate.instant('credential.updated'), 5000);
+
+ $scope.updateExistingListWithCredential(updated_cred);
});
}
@@ -369,7 +369,19 @@
}
credential.tags_raw = credential.tags;
- $rootScope.vaultCache[$scope.active_vault.guid].credentials.push(credential);
+
+ 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) {