diff options
-rw-r--r-- | lib/passwords.js | 9 | ||||
-rw-r--r-- | tests/test-password.js | 6 |
2 files changed, 7 insertions, 8 deletions
diff --git a/lib/passwords.js b/lib/passwords.js index a5adee0..f194e79 100644 --- a/lib/passwords.js +++ b/lib/passwords.js @@ -18,7 +18,7 @@ function getPasswordManager() { getService(Ci.nsILoginManager); } -exports.setPassword = function setPassword (username, pass, +exports.setLogin = function setLogin (username, pass, domain, realm) { var lInfo = getLoginInfo(username, pass, domain, realm); getPasswordManager().addLogin(lInfo); @@ -26,7 +26,7 @@ exports.setPassword = function setPassword (username, pass, var getPassword = exports.getPassword = function getPassword(username, domain, realm) { - + var pwMgr = getPasswordManager(); var logins = pwMgr.findLogins({}, domain, "", realm); var ourLogins = Array.filter(logins, function (x) { @@ -38,14 +38,13 @@ var getPassword = exports.getPassword = function getPassword(username, } else { return null; } -}; -exports.removePassword = function removePassword(username, +exports.removeLogin = function removeLogin(username, domain, realm) { var pass = getPassword(username, domain, realm); var pwMgr = getPasswordManager(); var logins = pwMgr.findLogins({}, domain, "", realm); - + // Don't do Array.forEach here ... emulating break there // is an abomination for (var i = 0, ii = logins.length; i < ii; i++) { diff --git a/tests/test-password.js b/tests/test-password.js index e605dc4..e46ed9c 100644 --- a/tests/test-password.js +++ b/tests/test-password.js @@ -8,11 +8,11 @@ var testLogin = "testUser"; var testPass = "verySecret"; var testDomain = "http://www.example.com"; -exports.ensureSetPassword = function (test) { - passMod.setPassword(testLogin, testPass, +exports.ensurePasswordMachinery = function (test) { + passMod.setLogin(testLogin, testPass, testDomain, BTSRealm); test.assertEqual(passMod.getPassword(testLogin, testDomain, BTSRealm), testPass, ""); - passMod.removePassword(testLogin, testPass, + passMod.removeLogin(testLogin, testPass, testDomain, BTSRealm); }; |