mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 590805 - Sync UI: Revamp setup wizard (part 3), r=mconnor a=blocking2.0
Generate Sync Key: Fix up the Change/Update Passphrase dialog in the preference pane.
This commit is contained in:
parent
07df33d720
commit
0041ac4399
@ -21,6 +21,7 @@
|
||||
* Edward Lee <edilee@mozilla.com>
|
||||
* Mike Connor <mconnor@mozilla.com>
|
||||
* Paul O’Shannessy <paul@oshannessy.com>
|
||||
* Philipp von Weitershausen <philipp@weitershausen.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@ -36,6 +37,9 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
|
||||
Components.utils.import("resource://services-sync/main.js");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
@ -47,6 +51,11 @@ let Change = {
|
||||
_firstBox: null,
|
||||
_secondBox: null,
|
||||
|
||||
get _passphraseBox() {
|
||||
delete this._passphraseBox;
|
||||
return this._passphraseBox = document.getElementById("passphraseBox");
|
||||
},
|
||||
|
||||
get _currentPasswordInvalid() {
|
||||
return Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED;
|
||||
},
|
||||
@ -57,8 +66,6 @@ let Change = {
|
||||
|
||||
onLoad: function Change_onLoad() {
|
||||
/* Load labels */
|
||||
let box1label = document.getElementById("textBox1Label");
|
||||
let box2label = document.getElementById("textBox2Label");
|
||||
let introText = document.getElementById("introText");
|
||||
let introText2 = document.getElementById("introText2");
|
||||
let warningText = document.getElementById("warningText");
|
||||
@ -77,26 +84,37 @@ let Change = {
|
||||
switch (this._dialogType) {
|
||||
case "UpdatePassphrase":
|
||||
case "ResetPassphrase":
|
||||
box1label.value = this._str("new.passphrase.label");
|
||||
document.getElementById("textBox1Row").hidden = true;
|
||||
document.getElementById("textBox2Row").hidden = true;
|
||||
let passphraseLabel = document.getElementById("passphraseLabel");
|
||||
passphraseLabel.value = this._str("new.synckey.label");
|
||||
|
||||
if (this._updatingPassphrase) {
|
||||
document.title = this._str("new.passphrase.title");
|
||||
introText.textContent = this._str("new.passphrase.introText");
|
||||
document.getElementById("passphraseBackupButtons").hidden = true;
|
||||
document.getElementById("generatePassphraseButton").hidden = true;
|
||||
document.title = this._str("new.synckey.title");
|
||||
introText.textContent = this._str("new.synckey.introText");
|
||||
this._dialog.getButton("accept")
|
||||
.setAttribute("label", this._str("new.passphrase.acceptButton"));
|
||||
document.getElementById("textBox2Row").hidden = true;
|
||||
.setAttribute("label", this._str("new.synckey.acceptButton"));
|
||||
}
|
||||
else {
|
||||
document.title = this._str("change.passphrase.title");
|
||||
box2label.value = this._str("new.passphrase.confirm");
|
||||
introText.textContent = this._str("change.passphrase.introText");
|
||||
introText2.textContent = this._str("change.passphrase.introText2");
|
||||
warningText.textContent = this._str("change.passphrase.warningText");
|
||||
let pp = Weave.Service.passphrase;
|
||||
if (pp.length == 20)
|
||||
pp = gSyncUtils.hyphenatePassphrase(pp);
|
||||
document.getElementById("passphraseBox").value = pp;
|
||||
document.title = this._str("change.synckey.title");
|
||||
introText.innerHTML = this._str("change.synckey.introText");
|
||||
introText2.innerHTML = this._str("change.synckey.introText2");
|
||||
warningText.innerHTML = this._str("change.synckey.warningText");
|
||||
this._dialog.getButton("accept")
|
||||
.setAttribute("label", this._str("change.passphrase.acceptButton"));
|
||||
.setAttribute("label", this._str("change.synckey.acceptButton"));
|
||||
}
|
||||
break;
|
||||
case "ChangePassword":
|
||||
document.getElementById("passphraseRow").hidden = true;
|
||||
document.getElementById("passphraseBackupButtons").hidden = true;
|
||||
let box1label = document.getElementById("textBox1Label");
|
||||
let box2label = document.getElementById("textBox2Label");
|
||||
box1label.value = this._str("new.password.label");
|
||||
|
||||
if (this._currentPasswordInvalid) {
|
||||
@ -151,11 +169,19 @@ let Change = {
|
||||
}
|
||||
},
|
||||
|
||||
doGeneratePassphrase: function () {
|
||||
let passphrase = gSyncUtils.generatePassphrase();
|
||||
let el = document.getElementById("passphraseBox");
|
||||
el.value = gSyncUtils.hyphenatePassphrase(passphrase);
|
||||
this._dialog.getButton("accept").disabled = false;
|
||||
},
|
||||
|
||||
doChangePassphrase: function Change_doChangePassphrase() {
|
||||
let pp = gSyncUtils.normalizePassphrase(this._passphraseBox.value);
|
||||
if (this._updatingPassphrase) {
|
||||
Weave.Service.passphrase = this._firstBox.value;
|
||||
Weave.Service.passphrase = pp;
|
||||
if (Weave.Service.login()) {
|
||||
this._updateStatus("change.passphrase.success", "success");
|
||||
this._updateStatus("change.synckey.success", "success");
|
||||
Weave.Service.persistLogin();
|
||||
}
|
||||
else {
|
||||
@ -163,12 +189,12 @@ let Change = {
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._updateStatus("change.passphrase.label", "active");
|
||||
this._updateStatus("change.synckey.label", "active");
|
||||
|
||||
if (Weave.Service.changePassphrase(this._firstBox.value))
|
||||
this._updateStatus("change.passphrase.success", "success");
|
||||
if (Weave.Service.changePassphrase(pp))
|
||||
this._updateStatus("change.synckey.success", "success");
|
||||
else
|
||||
this._updateStatus("change.passphrase.error", "error");
|
||||
this._updateStatus("change.synckey.error", "error");
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -197,7 +223,7 @@ let Change = {
|
||||
return false;
|
||||
},
|
||||
|
||||
validate: function (event) {
|
||||
validate: function () {
|
||||
let valid = false;
|
||||
let errorString = "";
|
||||
|
||||
@ -209,9 +235,9 @@ let Change = {
|
||||
}
|
||||
else {
|
||||
if (this._updatingPassphrase)
|
||||
[valid, errorString] = gSyncUtils.validatePassphrase(this._firstBox);
|
||||
[valid, errorString] = gSyncUtils.validatePassphrase(this._passphraseBox);
|
||||
else
|
||||
[valid, errorString] = gSyncUtils.validatePassphrase(this._firstBox, this._secondBox);
|
||||
[valid, errorString] = gSyncUtils.validatePassphrase(this._passphraseBox, true);
|
||||
}
|
||||
|
||||
if (errorString == "")
|
||||
|
@ -23,6 +23,7 @@
|
||||
# Edward Lee <edilee@mozilla.com>
|
||||
# Mike Connor <mconnor@mozilla.com>
|
||||
# Paul O’Shannessy <paul@oshannessy.com>
|
||||
# Philipp von Weitershausen <philipp@weitershausen.de>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@ -41,6 +42,14 @@
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/syncCommon.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
|
||||
<!ENTITY % syncSetupDTD SYSTEM "chrome://browser/locale/syncSetup.dtd">
|
||||
%brandDTD;
|
||||
%syncBrandDTD;
|
||||
%syncSetupDTD;
|
||||
]>
|
||||
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
id="change-dialog"
|
||||
@ -55,6 +64,8 @@
|
||||
src="chrome://browser/content/syncGenericChange.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/syncUtils.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://global/content/printUtils.js"/>
|
||||
|
||||
<hbox align="top">
|
||||
<image id="syncIcon"/>
|
||||
@ -69,19 +80,44 @@
|
||||
<grid>
|
||||
<columns>
|
||||
<column align="right"/>
|
||||
<column/>
|
||||
<column flex="3"/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<row id="textBox1Row" align="center">
|
||||
<label id="textBox1Label" control="textBox1"/>
|
||||
<textbox id="textBox1" type="password" oninput="Change.validate(event)"/>
|
||||
<textbox id="textBox1" type="password" oninput="Change.validate()"/>
|
||||
<spacer/>
|
||||
</row>
|
||||
<row id="textBox2Row">
|
||||
<row id="textBox2Row" align="center">
|
||||
<label id="textBox2Label" control="textBox2"/>
|
||||
<textbox id="textBox2" type="password" oninput="Change.validate(event)"/>
|
||||
<textbox id="textBox2" type="password" oninput="Change.validate()"/>
|
||||
<spacer/>
|
||||
</row>
|
||||
<row id="passphraseRow" align="center">
|
||||
<label id="passphraseLabel" control="passphraseBox"/>
|
||||
<textbox id="passphraseBox"
|
||||
onfocus="this.select()"
|
||||
oninput="Change.validate()"/>
|
||||
<label id="generatePassphraseButton"
|
||||
value="&syncKeyGenerate.label;"
|
||||
class="text-link inline-link"
|
||||
onclick="event.stopPropagation();
|
||||
Change.doGeneratePassphrase();"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<hbox id="passphraseBackupButtons">
|
||||
<button label="&button.syncKeyBackup.email.label;"
|
||||
accesskey="&button.syncKeyBackup.email.accesskey;"
|
||||
oncommand="gSyncUtils.passphraseEmail('passphraseBox');"/>
|
||||
<button label="&button.syncKeyBackup.print.label;"
|
||||
accesskey="&button.syncKeyBackup.print.accesskey;"
|
||||
oncommand="gSyncUtils.passphrasePrint('passphraseBox');"/>
|
||||
<button label="&button.syncKeyBackup.save.label;"
|
||||
accesskey="&button.syncKeyBackup.save.accesskey;"
|
||||
oncommand="gSyncUtils.passphraseSave('passphraseBox');"/>
|
||||
</hbox>
|
||||
|
||||
<description>
|
||||
<html:p class="data" id="warningText"/>
|
||||
|
@ -121,7 +121,7 @@
|
||||
value="&changePassword.label;"/>
|
||||
<label class="text-link"
|
||||
onclick="gSyncUtils.resetPassphrase(); return false;"
|
||||
value="&changePassphrase.label;"/>
|
||||
value="&mySyncKey.label;"/>
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.resetSync(); return false;"
|
||||
value="&resetSync.label;"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<!ENTITY manageAccount.label "Manage Account">
|
||||
<!ENTITY manageAccount.accesskey "A">
|
||||
<!ENTITY changePassword.label "Change Password">
|
||||
<!ENTITY changePassphrase.label "Change Secret Phrase">
|
||||
<!ENTITY mySyncKey.label "My Sync Key">
|
||||
<!ENTITY resetSync.label "Reset Sync">
|
||||
<!ENTITY differentAccount.label "Use a Different Account">
|
||||
|
||||
|
@ -8,18 +8,18 @@ change.password.status.error = There was an error changing your password.
|
||||
change.password.introText = Your password must be at least 8 characters long. It cannot be the same as either your user name or your secret phrase.
|
||||
change.password.warningText = Note: All of your other devices will be unable to connect to your account once you change this password.
|
||||
|
||||
change.passphrase.title = Change your Secret Phrase
|
||||
change.passphrase.acceptButton = Change Secret Phrase
|
||||
change.passphrase.label = Changing secret phrase and uploading local data, please wait…
|
||||
change.passphrase.error = There was an error while changing your secret phrase!
|
||||
change.passphrase.success = Your secret phrase was successfully changed!
|
||||
change.synckey.title = Change your Sync Key
|
||||
change.synckey.acceptButton = Change Sync Key
|
||||
change.synckey.label = Changing Sync Key and uploading local data, please wait…
|
||||
change.synckey.error = There was an error while changing your secret phrase!
|
||||
change.synckey.success = Your secret phrase was successfully changed!
|
||||
|
||||
# LOCALIZATION NOTE (change.passphrase.introText) "Sync" should match &syncBrand.shortName.label; from syncBrand.dtd
|
||||
change.passphrase.introText = Your secret phrase must be at least 12 characters long. Sync uses this phrase as part of encrypting your data.
|
||||
# LOCALIZATION NOTE (change.passphrase.introText2) "Firefox Sync" should match syncBrand.fullName.label from syncBrand.dtd
|
||||
change.passphrase.introText2 = You may wish to write this down, as this is never sent over the Internet and is not backed up or synced by Firefox Sync for your security.
|
||||
# LOCALIZATION NOTE (change.passphrase.warningText) "Sync" should match &syncBrand.shortName.label; from syncBrand.dtd
|
||||
change.passphrase.warningText = Note: This will erase all data stored on the Sync server and upload new data secured by this phrase. Your other devices will not sync until the secret phrase is entered for that device.
|
||||
change.synckey.introText = Firefox Cares About Your Privacy
|
||||
change.synckey.introText2 = To ensure your total privacy, all of your data is encrypted prior to being uploaded. The key to decrypt your data is not uploaded.
|
||||
# LOCALIZATION NOTE (change.synckey.warningText) "Sync" should match &syncBrand.shortName.label; from syncBrand.dtd
|
||||
change.synckey.warningText = Note: Changing this will erase all data stored on the Sync server and upload new data secured by this phrase. Your other devices will not sync until the new Sync Key is entered for that device.
|
||||
|
||||
new.synckey.label = Your Sync Key
|
||||
|
||||
# LOCALIZATION NOTE (new.password.title): This (and associated new.password/passphrase) are used on a second computer when it detects that your password or passphrase has been changed on a different device.
|
||||
new.password.title = Update Password
|
||||
@ -29,9 +29,7 @@ new.password.confirm = Confirm your new password
|
||||
new.password.acceptButton = Update Password
|
||||
new.password.status.incorrect = Password incorrect, please try again.
|
||||
|
||||
new.passphrase.title = Update Secret Phrase
|
||||
new.passphrase.introText = Your secret phrase has changed, please enter your new secret phrase
|
||||
new.passphrase.label = New secret phrase
|
||||
new.passphrase.confirm = Confirm secret phrase
|
||||
new.passphrase.acceptButton = Update Secret Phrase
|
||||
new.passphrase.status.incorrect = Secret phrase incorrect, please try again.
|
||||
new.synckey.title = Update Sync Key
|
||||
new.synckey.introText = Your Sync Key has changed, please enter your new Sync Key
|
||||
new.synckey.acceptButton = Update Sync Key
|
||||
new.synckey.status.incorrect = Sync Key incorrect, please try again.
|
||||
|
Loading…
Reference in New Issue
Block a user