From 29b2a937a6bcbcf4bb6642128f6bef31bae0baab Mon Sep 17 00:00:00 2001 From: Philipp von Weitershausen Date: Thu, 14 Oct 2010 11:12:15 +0200 Subject: [PATCH] Bug 600560 - Sync UI: Strength meter does not disappear when sync key field is cleared. r=mconnor a=blocking-beta8 --- browser/base/content/syncSetup.js | 7 +++++-- browser/base/content/syncUtils.js | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/browser/base/content/syncSetup.js b/browser/base/content/syncSetup.js index 715f612a3a9..3f12cce20ef 100644 --- a/browser/base/content/syncSetup.js +++ b/browser/base/content/syncSetup.js @@ -341,7 +341,7 @@ var gSyncSetup = { // xxxmpc - hack, sigh if (el1.value == document.getElementById("weavePassword").value) { valid = false; - str = Weave.Utils.getErrorString("change.passphrase.ppSameAsPassword"); + str = Weave.Utils.getErrorString("change.synckey.sameAsPassword"); } else { [valid, str] = gSyncUtils.validatePassphrase(el1); @@ -349,8 +349,11 @@ var gSyncSetup = { let feedback = document.getElementById("passphraseFeedbackRow"); this._setFeedback(feedback, valid, str); - if (!valid) + if (!valid) { + // Hide strength meter if we're displaying an error. + document.getElementById("passphraseStrengthRow").hidden = true; return valid; + } // No passphrase strength meter for the generated key. if (!this._haveCustomSyncKey) diff --git a/browser/base/content/syncUtils.js b/browser/base/content/syncUtils.js index b802cf7138f..469f19efb35 100644 --- a/browser/base/content/syncUtils.js +++ b/browser/base/content/syncUtils.js @@ -299,7 +299,9 @@ let gSyncUtils = { let val = el.value; let error = ""; - if (val == Weave.Service.username) + if (val.length < Weave.MIN_PP_LENGTH) + error = "change.synckey.tooShort"; + else if (val == Weave.Service.username) error = "change.synckey.sameAsUsername"; else if (val == Weave.Service.account) error = "change.synckey.sameAsEmail"; @@ -307,8 +309,6 @@ let gSyncUtils = { error = "change.synckey.sameAsPassword"; else if (change && val == Weave.Service.passphrase) error = "change.synckey.sameAsSyncKey"; - else if (val.length < Weave.MIN_PP_LENGTH) - error = "change.synckey.tooShort"; else valid = true;