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/app
diff options
context:
space:
mode:
authorfnuesse <felix.nuesse@t-online.de>2018-10-29 11:20:07 +0300
committerfnuesse <felix.nuesse@t-online.de>2018-11-21 19:34:18 +0300
commit7694c291b7ecbb5014f22bff5ff258660bb386b2 (patch)
treeff79015a627c2ad97fde92388dac9c5b2cdb10fd /js/app
parentea01990672f4448a06cf191bec724dfe62f6f59f (diff)
Partialfix for #486 THIS DOES NOT CLOSE IT! v2
Diffstat (limited to 'js/app')
-rw-r--r--js/app/controllers/edit_credential.js30
1 files changed, 21 insertions, 9 deletions
diff --git a/js/app/controllers/edit_credential.js b/js/app/controllers/edit_credential.js
index 5c9ad4f0..6f1abc9a 100644
--- a/js/app/controllers/edit_credential.js
+++ b/js/app/controllers/edit_credential.js
@@ -32,8 +32,8 @@
* Controller of the passmanApp
*/
angular.module('passmanApp')
- .controller('CredentialEditCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'FileService', 'EncryptService', 'TagService', 'NotificationService', 'ShareService', '$translate',
- function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, FileService, EncryptService, TagService, NotificationService, ShareService, $translate) {
+ .controller('CredentialEditCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'FileService', 'EncryptService', 'TagService', 'NotificationService', 'ShareService', '$translate', '$rootScope',
+ function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, FileService, EncryptService, TagService, NotificationService, ShareService, $translate, $rootScope) {
$scope.active_vault = VaultService.getActiveVault();
if (!SettingsService.getSetting('defaultVault') || !SettingsService.getSetting('defaultVaultPass')) {
if (!$scope.active_vault) {
@@ -292,7 +292,7 @@
};
$scope.saving = false;
$scope.saveCredential = function () {
- $scope.saving = true;
+ $scope.saving = true;
if ($scope.new_custom_field.label && $scope.new_custom_field.value) {
@@ -301,8 +301,8 @@
if ($scope.storedCredential.password !== $scope.storedCredential.password_repeat){
- $scope.saving = false;
- NotificationService.showNotification($translate.instant('password.do.not.match'), 5000);
+ $scope.saving = false;
+ NotificationService.showNotification($translate.instant('password.do.not.match'), 5000);
return;
}
@@ -313,7 +313,7 @@
if (!$scope.storedCredential.credential_id) {
$scope.storedCredential.vault_id = $scope.active_vault.vault_id;
CredentialService.createCredential($scope.storedCredential).then(function () {
- $scope.saving = false;
+ $scope.saving = false;
$location.path('/vault/' + $routeParams.vault_id);
NotificationService.showNotification($translate.instant('credential.created'), 5000);
@@ -345,14 +345,26 @@
_credential.description = _credential.description.replace(regex, "");
}
CredentialService.updateCredential(_credential, _useKey).then(function () {
- $scope.saving = false;
+ $scope.saving = false;
SettingsService.setSetting('edit_credential', null);
$location.path('/vault/' + $routeParams.vault_id);
NotificationService.showNotification($translate.instant('credential.updated'), 5000);
});
}
-
- };
+ $scope.refreshListWithSaved();
+ };
+
+ $scope.refreshListWithSaved = function () {
+ var current_vault = $rootScope.vaultCache[$scope.active_vault.guid];
+ var cv_credentials = current_vault.credentials;
+ for (var i = 0; i < cv_credentials.length; i++) {
+ if (cv_credentials[i].credential_id === $scope.storedCredential.credential_id) {
+ cv_credentials[i] = $scope.storedCredential;
+ }
+ }
+ current_vault.credentials=cv_credentials;
+ $rootScope.vaultCache[$scope.active_vault.guid] = current_vault;
+ };
$scope.cancel = function () {
$location.path('/vault/' + $routeParams.vault_id);