diff --git a/security/manager/locales/en-US/chrome/pippki/pippki.properties b/security/manager/locales/en-US/chrome/pippki/pippki.properties index 3daf675f58ec..165fb3f65014 100644 --- a/security/manager/locales/en-US/chrome/pippki/pippki.properties +++ b/security/manager/locales/en-US/chrome/pippki/pippki.properties @@ -72,14 +72,4 @@ pageInfo_CertificateTransparency_Compliant=This website complies with the Certif # Token Manager password_not_set=(not set) -failed_pw_change=Unable to change Master Password. -incorrect_pw=You did not enter the correct current Master Password. Please try again. -pw_change_ok=Master Password successfully changed. -pw_erased_ok=Warning! You have deleted your Master Password. -pw_not_wanted=Warning! You have decided not to use a Master Password. -pw_empty_warning=Your stored web and email passwords, form data, and private keys will not be protected. -pw_change2empty_in_fips_mode=You are currently in FIPS mode. FIPS requires a non-empty Master Password. enable_fips=Enable FIPS - -resetPasswordConfirmationTitle=Reset Master Password -resetPasswordConfirmationMessage=Your password has been reset. diff --git a/security/manager/locales/en-US/security/pippki/pippki.ftl b/security/manager/locales/en-US/security/pippki/pippki.ftl index bfd213272fa8..047b006a4adf 100644 --- a/security/manager/locales/en-US/security/pippki/pippki.ftl +++ b/security/manager/locales/en-US/security/pippki/pippki.ftl @@ -16,6 +16,16 @@ change-password-old = Current password: change-password-new = New password: change-password-reenter = New password (again): +pippki-failed-pw-change = Unable to change password. +pippki-incorrect-pw = You did not enter the correct current password. Please try again. +pippki-pw-change-ok = Password successfully changed. + +pippki-pw-empty-warning = Your stored passwords and private keys will not be protected. +pippki-pw-erased-ok = You have deleted your password. { pippki-pw-empty-warning } +pippki-pw-not-wanted = Warning! You have decided not to use a password. { pippki-pw-empty-warning } + +pippki-pw-change2empty-in-fips-mode = You are currently in FIPS mode. FIPS requires a non-empty password. + ## Reset Primary Password dialog reset-primary-password-window = @@ -25,6 +35,9 @@ reset-password-button-label = .label = Reset reset-primary-password-text = If you reset your Primary Password, all your stored web and e-mail passwords, personal certificates, and private keys will be forgotten. Are you sure you want to reset your Primary Password? +pippki-reset-password-confirmation-title = Reset Primary Password +pippki-reset-password-confirmation-message = Your Primary Password has been reset. + ## Downloading cert dialog download-cert-window = diff --git a/security/manager/pki/resources/content/changepassword.js b/security/manager/pki/resources/content/changepassword.js index c198202ffd41..10cbf9f16273 100644 --- a/security/manager/pki/resources/content/changepassword.js +++ b/security/manager/pki/resources/content/changepassword.js @@ -4,12 +4,22 @@ "use strict"; const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const { XPCOMUtils } = ChromeUtils.import( + "resource://gre/modules/XPCOMUtils.jsm" +); + +XPCOMUtils.defineLazyGetter( + this, + "l10n", + () => new Localization(["security/pippki/pippki.ftl"], true) +); var params; var token; var pw1; -function doPrompt(msg) { +function doPrompt(messageL10nId) { + let msg = l10n.formatValueSync(messageL10nId); Services.prompt.alert(window, null, msg); } @@ -65,7 +75,6 @@ function process() { function setPassword(event) { var oldpwbox = document.getElementById("oldpw"); var initpw = oldpwbox.getAttribute("inited"); - var bundle = document.getElementById("pippki_bundle"); var success = false; @@ -91,20 +100,16 @@ function setPassword(event) { ].getService(Ci.nsIPKCS11ModuleDB); if (secmoddb.isFIPSEnabled) { // empty passwords are not allowed in FIPS mode - doPrompt(bundle.getString("pw_change2empty_in_fips_mode")); + doPrompt("pippki-pw-change2empty-in-fips-mode"); passok = 0; } } if (passok) { token.changePassword(oldpw, pw1.value); if (pw1.value == "") { - doPrompt( - bundle.getString("pw_erased_ok") + - " " + - bundle.getString("pw_empty_warning") - ); + doPrompt("pippki-pw-erased-ok"); } else { - doPrompt(bundle.getString("pw_change_ok")); + doPrompt("pippki-pw-change-ok"); } success = true; } @@ -112,19 +117,15 @@ function setPassword(event) { } else { oldpwbox.focus(); oldpwbox.setAttribute("value", ""); - doPrompt(bundle.getString("incorrect_pw")); + doPrompt("pippki-incorrect-pw"); } } catch (e) { - doPrompt(bundle.getString("failed_pw_change")); + doPrompt("pippki-failed-pw-change"); } } else { token.initPassword(pw1.value); if (pw1.value == "") { - doPrompt( - bundle.getString("pw_not_wanted") + - " " + - bundle.getString("pw_empty_warning") - ); + doPrompt("pippki-pw-not-wanted"); } success = true; } diff --git a/security/manager/pki/resources/content/resetpassword.js b/security/manager/pki/resources/content/resetpassword.js index 6c7a895a0155..960996c7c011 100644 --- a/security/manager/pki/resources/content/resetpassword.js +++ b/security/manager/pki/resources/content/resetpassword.js @@ -17,16 +17,16 @@ function resetPassword() { Services.logins.removeAllLogins(); } catch (e) {} - var bundle = document.getElementById("pippki_bundle"); + let l10n = new Localization(["security/pippki/pippki.ftl"], true); var promptService = Cc[ "@mozilla.org/embedcomp/prompt-service;1" ].getService(); promptService = promptService.QueryInterface(Ci.nsIPromptService); - if (promptService && bundle) { + if (promptService && l10n) { promptService.alert( window, - bundle.getString("resetPasswordConfirmationTitle"), - bundle.getString("resetPasswordConfirmationMessage") + l10n.formatValueSync("pippki-reset-password-confirmation-title"), + l10n.formatValueSync("pippki-reset-password-confirmation-message") ); } }