Bug 623795 - Sync setup and Add a Device wizard should trigger master password dialog. r=philikon a=blocking-betaN

This commit is contained in:
Richard Newman 2011-01-13 21:43:25 -08:00
parent e4d2ecc139
commit fbf56820b5
3 changed files with 26 additions and 4 deletions

View File

@ -131,11 +131,15 @@ var gSyncSetup = {
},
startNewAccountSetup: function () {
if (!Weave.Utils.ensureMPUnlocked())
return false;
this._settingUpNew = true;
this.wizard.pageIndex = NEW_ACCOUNT_START_PAGE;
},
useExistingAccount: function () {
if (!Weave.Utils.ensureMPUnlocked())
return false;
this._settingUpNew = false;
this.wizard.pageIndex = EXISTING_ACCOUNT_CONNECT_PAGE;
},
@ -207,7 +211,7 @@ var gSyncSetup = {
case INTRO_PAGE:
return false;
case NEW_ACCOUNT_START_PAGE:
for (i in this.status) {
for (let i in this.status) {
if (!this.status[i])
return false;
}
@ -376,6 +380,18 @@ var gSyncSetup = {
},
onWizardAdvance: function () {
// Check pageIndex so we don't prompt before the Sync setup wizard appears.
// This is a fallback in case the Master Password gets locked mid-wizard.
if ((this.wizard.pageIndex >= 0) &&
!Weave.Utils.ensureMPUnlocked()) {
// Leave canAdvance set according to onPageShow, because it dictates
// whether the Next button stays enabled. Return false to prevent the
// wizard from advancing to the next page.
this.onPageShow();
return false;
}
if (!this.wizard.pageIndex)
return true;

View File

@ -82,15 +82,18 @@ let gSyncUtils = {
},
changePassword: function () {
this.openChange("ChangePassword");
if (Weave.Utils.ensureMPUnlocked())
this.openChange("ChangePassword");
},
resetPassphrase: function () {
this.openChange("ResetPassphrase");
if (Weave.Utils.ensureMPUnlocked())
this.openChange("ResetPassphrase");
},
updatePassphrase: function () {
this.openChange("UpdatePassphrase");
if (Weave.Utils.ensureMPUnlocked())
this.openChange("UpdatePassphrase");
},
resetPassword: function () {

View File

@ -162,6 +162,9 @@ let gSyncPane = {
},
openAddDevice: function () {
if (!Weave.Utils.ensureMPUnlocked())
return;
let win = Services.wm.getMostRecentWindow("Sync:AddDevice");
if (win)
win.focus();