summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/sync_setup_overlay.js
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-27 23:17:28 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-27 23:17:28 +0000
commitb4923e659309eb7596567987e6f20a9bbbdb589e (patch)
tree0ca5704be465f7075be99af67f1d26ea8990d69c /chrome/browser/resources/sync_setup_overlay.js
parentdc69875b2aecfb3ed0f3a2489b7bb7cd98875a7c (diff)
downloadchromium_src-b4923e659309eb7596567987e6f20a9bbbdb589e.zip
chromium_src-b4923e659309eb7596567987e6f20a9bbbdb589e.tar.gz
chromium_src-b4923e659309eb7596567987e6f20a9bbbdb589e.tar.bz2
[Sync] Fix sync UI handling of passphrases.
The UI's handling of which passphrase to use now depends on which UI is visible and is handled a bit more elegantly. We now send down an empty passphrase if that's what the user entered. If encrypted datatypes are enabled, this will trigger a passphrase failure, prompting for a new passphrase. If they are not enabled, the passphrase is silently accepted, until the user attempts to enable an encrypted type. BUG=90603 TEST=Sign into sync with an account with existing passphrase. Enter empty passphrase. Review URL: http://codereview.chromium.org/7514032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94382 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/sync_setup_overlay.js')
-rw-r--r--chrome/browser/resources/sync_setup_overlay.js41
1 files changed, 23 insertions, 18 deletions
diff --git a/chrome/browser/resources/sync_setup_overlay.js b/chrome/browser/resources/sync_setup_overlay.js
index a5ebbd8..c41b5a6 100644
--- a/chrome/browser/resources/sync_setup_overlay.js
+++ b/chrome/browser/resources/sync_setup_overlay.js
@@ -214,31 +214,36 @@ cr.define('options', function() {
}
var f = $('choose-data-types-form');
- // Must be done before we disable input elements.
- if (!this.checkPassphraseMatch_())
- return;
- // Don't allow the user to tweak the settings once we send the
- // configuration to the backend.
- this.setInputElementsDisabledState_(true);
-
- var syncAll =
- document.getElementById('sync-select-datatypes').selectedIndex == 0;
- var usePassphrase = this.getPassphraseRadioCheckedValue_() == 'explicit';
+ var syncAll = $('sync-select-datatypes').selectedIndex == 0;
var encryptAllData = this.getEncryptionRadioCheckedValue_() == 'all';
+ var usePassphrase;
var customPassphrase;
- // If we were prompted for an existing passphrase, use it.
- if (!$('sync-existing-passphrase-container').hidden)
+ if (!$('sync-existing-passphrase-container').hidden) {
+ // If we were prompted for an existing passphrase, use it.
customPassphrase = f.passphrase.value;
- else
+ usePassphrase = true;
+ // We allow an empty passphrase, in case the user has disabled
+ // all their encrypted datatypes. In that case, the PSS will accept
+ // the passphrase and finish configuration. If the user has enabled
+ // encrypted datatypes, the PSS will prompt again specifying that the
+ // passphrase failed.
+ } else if (!$('google-option').disabled &&
+ this.getPassphraseRadioCheckedValue_() == 'explicit') {
+ // The user is setting a custom passphrase for the first time.
+ if (!this.checkPassphraseMatch_())
+ return;
customPassphrase = $('custom-passphrase').value;
-
- // If the user has not actually entered a passphrase (for example on
- // customize when the passphrase box is hidden), we don't attempt to reset
- // the passphrase.
- if (customPassphrase.length == 0)
+ usePassphrase = true;
+ } else {
+ // The user is not setting a custom passphrase.
usePassphrase = false;
+ }
+
+ // Don't allow the user to tweak the settings once we send the
+ // configuration to the backend.
+ this.setInputElementsDisabledState_(true);
// These values need to be kept in sync with where they are read in
// SyncSetupFlow::GetDataTypeChoiceData().