diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /security/manager/pki/resources/content/resetpassword.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'security/manager/pki/resources/content/resetpassword.js')
-rw-r--r-- | security/manager/pki/resources/content/resetpassword.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/security/manager/pki/resources/content/resetpassword.js b/security/manager/pki/resources/content/resetpassword.js new file mode 100644 index 000000000..35dc5b2e5 --- /dev/null +++ b/security/manager/pki/resources/content/resetpassword.js @@ -0,0 +1,47 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/* import-globals-from pippki.js */ +"use strict"; + +const nsPK11TokenDB = "@mozilla.org/security/pk11tokendb;1"; +const nsIPK11TokenDB = Components.interfaces.nsIPK11TokenDB; +const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock; + +var tokenName; + +function onLoad() +{ + if ("arguments" in window) { + var params = window.arguments[0].QueryInterface(nsIDialogParamBlock); + tokenName = params.GetString(1); + } else { + tokenName = self.name; + } +} + +function resetPassword() +{ + var pk11db = Components.classes[nsPK11TokenDB].getService(nsIPK11TokenDB); + var token = pk11db.findTokenByName(tokenName); + token.reset(); + + try { + var loginManager = Components.classes["@mozilla.org/login-manager;1"]. + getService(Components.interfaces.nsILoginManager); + loginManager.removeAllLogins(); + } catch (e) { + } + + var bundle = document.getElementById("pippki_bundle"); + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(); + promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService); + if (promptService && bundle) { + promptService.alert(window, + bundle.getString("resetPasswordConfirmationTitle"), + bundle.getString("resetPasswordConfirmationMessage")); + } + + return true; +} + |