Bug 399703 - Password manager offers to store logins with empty passwords. r=gavin

This commit is contained in:
Justin Dolske 2008-09-07 00:12:34 -07:00
parent b371c503be
commit f2847be93e

View File

@ -268,6 +268,11 @@ LoginManagerPrompter.prototype = {
if (!ok || !checkBox.value || !hostname)
return ok;
if (!aPassword.value) {
this.log("No password entered, so won't offer to save.");
return ok;
}
var newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
newLogin.init(hostname, null, realm, aUsername.value, aPassword.value,
@ -350,7 +355,7 @@ LoginManagerPrompter.prototype = {
aText, aPassword,
checkBoxLabel, checkBox);
if (ok && checkBox.value && hostname) {
if (ok && checkBox.value && hostname && aPassword.value) {
var newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
newLogin.init(hostname, null, realm, username,
@ -468,6 +473,11 @@ LoginManagerPrompter.prototype = {
try {
var [username, password] = this._GetAuthInfo(aAuthInfo);
if (!password) {
this.log("No password entered, so won't offer to save.");
return ok;
}
var newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
newLogin.init(hostname, null, httpRealm,