From f0a9a28984b38bdebf04610787c77bc9e11dfb39 Mon Sep 17 00:00:00 2001 From: brantje Date: Tue, 27 Sep 2016 21:10:04 +0200 Subject: [PATCH] Revert "Just use the first credential to check if vault pass is ok" This reverts commit faf54d4e39caac76dd68d17640ca266be25ff576. --- js/app/controllers/vault.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/js/app/controllers/vault.js b/js/app/controllers/vault.js index 06df43ba..d822454c 100644 --- a/js/app/controllers/vault.js +++ b/js/app/controllers/vault.js @@ -67,10 +67,12 @@ angular.module('passmanApp') $scope.selectVault = function (vault) { $scope.list_selected_vault = vault; }; - $scope.sharing_keys = {}; + $scope.sharing_keys= {}; $scope.newVault = function () { $scope.creating_vault = true; - var _vault = {}; + var _vault = { + + }; var key_size = 1024; ShareService.generateRSAKeys(key_size).progress(function (progress) { var p = progress > 0 ? 2 : 1; @@ -100,19 +102,23 @@ angular.module('passmanApp') _vault.vaultKey = angular.copy(vault_key); VaultService.setActiveVault(_vault); VaultService.getVault(vault).then(function (credentials) { - - var credential = credentials[0]; - - try { - var c = CredentialService.decryptCredential(credential); - if ($scope.remember_vault_password) { - SettingsService.setSetting('defaultVaultPass', vault_key); + for (var i = 0; i < credentials.length; i++) { + var credential = credentials[i]; + if (credential.hidden = true) { + try { + var c = CredentialService.decryptCredential(credential); + if (c.password === 'lorum ipsum') { + if ($scope.remember_vault_password) { + SettingsService.setSetting('defaultVaultPass', vault_key); + } + _loginToVault(vault, vault_key); + } + } catch (e) { + $scope.error = 'Incorrect vault password!' + } + break; } - _loginToVault(vault, vault_key); - } catch (e) { - $scope.error = 'Incorrect vault password!' } - }) };