diff options
author | brantje <brantje@gmail.com> | 2016-10-08 16:48:42 +0300 |
---|---|---|
committer | brantje <brantje@gmail.com> | 2016-10-08 16:48:42 +0300 |
commit | 21420db06a1abd3a033bdc9c59a38415858be03e (patch) | |
tree | 228a8b70e0ad6af15bcbc1d20b37a1cae67ad03f /js | |
parent | 386465cd51cb36a44b10de0f38370b1fc9c2a423 (diff) |
Fix pwSettings not loading
Diffstat (limited to 'js')
-rw-r--r-- | js/app/controllers/edit_credential.js | 40 | ||||
-rw-r--r-- | js/app/controllers/settings.js | 49 |
2 files changed, 51 insertions, 38 deletions
diff --git a/js/app/controllers/edit_credential.js b/js/app/controllers/edit_credential.js index 63a25628..f31e5fd1 100644 --- a/js/app/controllers/edit_credential.js +++ b/js/app/controllers/edit_credential.js @@ -16,31 +16,35 @@ if (!SettingsService.getSetting('defaultVault') || !SettingsService.getSetting('defaultVaultPass')) { if (!$scope.active_vault) { $location.path('/'); + return; } } else { if (SettingsService.getSetting('defaultVault') && SettingsService.getSetting('defaultVaultPass')) { var _vault = angular.copy(SettingsService.getSetting('defaultVault')); - VaultService.getVault(_vault).then(function (vault) { - vault.vaultKey = angular.copy(SettingsService.getSetting('defaultVaultPass')); - VaultService.setActiveVault(vault); - $scope.active_vault = vault; - - $scope.pwSettings = VaultService.getVaultSetting('pwSettings', - { - 'length': 12, - 'useUppercase': true, - 'useLowercase': true, - 'useDigits': true, - 'useSpecialChars': true, - 'minimumDigitCount': 3, - 'avoidAmbiguousCharacters': false, - 'requireEveryCharType': true, - 'generateOnCreate': true - }); - }); + _vault.vaultKey = SettingsService.getSetting('defaultVaultPass'); + VaultService.setActiveVault(_vault); + $scope.active_vault = _vault; } } + VaultService.getVault($scope.active_vault).then(function (vault) { + vault.vaultKey = SettingsService.getSetting('defaultVaultPass'); + delete vault.credentials; + VaultService.setActiveVault(vault); + $scope.pwSettings = VaultService.getVaultSetting('pwSettings', + { + 'length': 12, + 'useUppercase': true, + 'useLowercase': true, + 'useDigits': true, + 'useSpecialChars': true, + 'minimumDigitCount': 3, + 'avoidAmbiguousCharacters': false, + 'requireEveryCharType': true, + 'generateOnCreate': true + }); + }); + $scope.tabs = [{ title: 'General', url: 'views/partials/forms/edit_credential/basics.html', diff --git a/js/app/controllers/settings.js b/js/app/controllers/settings.js index 57af0606..fe150202 100644 --- a/js/app/controllers/settings.js +++ b/js/app/controllers/settings.js @@ -18,31 +18,40 @@ if (!SettingsService.getSetting('defaultVault') || !SettingsService.getSetting('defaultVaultPass')) { if (!$scope.active_vault) { $location.path('/'); + return; } } else { if (SettingsService.getSetting('defaultVault') && SettingsService.getSetting('defaultVaultPass')) { var _vault = angular.copy(SettingsService.getSetting('defaultVault')); - VaultService.getVault(_vault).then(function (vault) { - vault.vaultKey = SettingsService.getSetting('defaultVaultPass'); - VaultService.setActiveVault(vault); - $scope.active_vault = vault; - $scope.$parent.selectedVault = true; - $scope.vault_settings.pwSettings = VaultService.getVaultSetting('pwSettings', - { - 'length': 12, - 'useUppercase': true, - 'useLowercase': true, - 'useDigits': true, - 'useSpecialChars': true, - 'minimumDigitCount': 3, - 'avoidAmbiguousCharacters': false, - 'requireEveryCharType': true, - 'generateOnCreate': true - }); - $scope.new_vault_name = angular.copy($scope.active_vault.name); - }); + _vault.vaultKey = SettingsService.getSetting('defaultVaultPass'); + VaultService.setActiveVault(_vault); + $scope.active_vault = _vault; } } + + VaultService.getVault($scope.active_vault).then(function (vault) { + vault.vaultKey = SettingsService.getSetting('defaultVaultPass'); + delete vault.credentials; + VaultService.setActiveVault(vault); + console.log(vault); + $scope.vault_settings = vault.vault_settings; + if(!$scope.vault_settings.hasOwnProperty('pwSettings')){ + $scope.vault_settings.pwSettings = { + 'length': 12, + 'useUppercase': true, + 'useLowercase': true, + 'useDigits': true, + 'useSpecialChars': true, + 'minimumDigitCount': 3, + 'avoidAmbiguousCharacters': false, + 'requireEveryCharType': true, + 'generateOnCreate': true + }; + } + }); + + + var http = location.protocol, slashes = http.concat("//"), host = slashes.concat(window.location.hostname), complete = host + location.pathname; $scope.bookmarklet = $sce.trustAsHtml("<a class=\"button\" href=\"javascript:(function(){var a=window,b=document,c=encodeURIComponent,e=c(document.title),d=a.open('" + complete + "bookmarklet?url='+c(b.location)+'&title='+e,'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=750px,width=475px,resizable=0,alwaysRaised=1');a.setTimeout(function(){d.focus()},300);})();\">Save in passman</a>"); @@ -52,7 +61,7 @@ _vault.name = $scope.new_vault_name; _vault.vault_settings = angular.copy($scope.vault_settings); VaultService.updateVault(_vault).then(function () { - VaultService.setActiveVault(_vault); + //VaultService.setActiveVault(_vault); $scope.active_vault.name = angular.copy(_vault.name); NotificationService.showNotification('Settings saved', 5000); }); |