Bug 624552 - Disable Firefox Sync temporarily when master password entry fails. [r=mfinkle]

This commit is contained in:
Matt Brubeck 2011-08-22 20:45:30 -07:00
Родитель 68a4215535
Коммит 304dcc1d01
1 изменённых файлов: 18 добавлений и 6 удалений

Просмотреть файл

@ -382,8 +382,6 @@ let WeaveGlue = {
}, },
observe: function observe(aSubject, aTopic, aData) { observe: function observe(aSubject, aTopic, aData) {
let loggedIn = Weave.Service.isLoggedIn;
// Make sure we're online when connecting/syncing // Make sure we're online when connecting/syncing
Util.forceOnline(); Util.forceOnline();
@ -400,7 +398,13 @@ let WeaveGlue = {
let disconnect = this._elements.disconnect; let disconnect = this._elements.disconnect;
let sync = this._elements.sync; let sync = this._elements.sync;
let syncEnabled = this._elements.autosync.value; let syncEnabled = autosync.value;
let loggedIn = Weave.Service.isLoggedIn;
// Sync may successfully log in after it was temporarily disabled by a
// canceled master password entry. If so, then re-enable it.
if (loggedIn && !syncEnabled)
syncEnabled = autosync.value = true;
// If Sync is not enabled, hide the connection row visibility // If Sync is not enabled, hide the connection row visibility
if (syncEnabled) { if (syncEnabled) {
@ -451,10 +455,18 @@ let WeaveGlue = {
} }
// Show what went wrong with login if necessary // Show what went wrong with login if necessary
if (aTopic == "weave:service:login:error") if (aTopic == "weave:service:login:error") {
if (Weave.Status.login == "service.master_password_locked") {
// Disable sync temporarily. Sync will try again after a set interval,
// or if the user presses the button to enable it again.
autosync.value = false;
this.toggleSyncEnabled();
} else {
connect.setAttribute("desc", Weave.Utils.getErrorString(Weave.Status.login)); connect.setAttribute("desc", Weave.Utils.getErrorString(Weave.Status.login));
else }
} else {
connect.removeAttribute("desc"); connect.removeAttribute("desc");
}
// Init the setup data if we just logged in // Init the setup data if we just logged in
if (!this.setupData && aTopic == "weave:service:login:finish") if (!this.setupData && aTopic == "weave:service:login:finish")