Bug 532570 - "keyring doesn't contain a key" when signing-in with a differently-cased username

Make sure username is always lowercase so that pubkey uri, storage uri, etc. are all the same no matter how the user logged in. Server needs to be wiped to make sure existing keys with other casing are removed.
This commit is contained in:
Edward Lee 2009-12-02 18:25:18 -08:00
parent 835dcd80cf
commit 0da867fd27
2 changed files with 6 additions and 3 deletions

View File

@ -85,7 +85,7 @@ Identity.prototype = {
// Look up the password then cache it // Look up the password then cache it
if (this._password == null) if (this._password == null)
for each (let login in this._logins) for each (let login in this._logins)
if (login.username == this.username) if (login.username.toLowerCase() == this.username)
this._password = login.password; this._password = login.password;
return this._password; return this._password;
}, },

View File

@ -108,11 +108,14 @@ WeaveSvc.prototype = {
_keyPair: {}, _keyPair: {},
get username() { get username() {
return Svc.Prefs.get("username", ""); return Svc.Prefs.get("username", "").toLowerCase();
}, },
set username(value) { set username(value) {
if (value) if (value) {
// Make sure all uses of this new username is lowercase
value = value.toLowerCase();
Svc.Prefs.set("username", value); Svc.Prefs.set("username", value);
}
else else
Svc.Prefs.reset("username"); Svc.Prefs.reset("username");