!import
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
1 //@line 38 "/home/visbrero/mnt/roisin/rev_control/hg/mozilla/toolkit/mozapps/preferences/removemp.js"
2
3 var gRemovePasswordDialog = {
4 _token : null,
5 _bundle : null,
6 _prompt : null,
7 _okButton : null,
8 _password : null,
init
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
9 init: function ()
10 {
11 this._prompt = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
12 .getService(Components.interfaces.nsIPromptService);
13 this._bundle = document.getElementById("bundlePreferences");
14
15 this._okButton = document.documentElement.getButton("accept");
16 this._okButton.label = this._bundle.getString("pw_remove_button");
17
18 this._password = document.getElementById("password");
19
20 var pk11db = Components.classes["@mozilla.org/security/pk11tokendb;1"]
21 .getService(Components.interfaces.nsIPK11TokenDB);
22 this._token = pk11db.getInternalKeyToken();
23
24 // Initialize the enabled state of the Remove button by checking the
25 // initial value of the password ("" should be incorrect).
26 this.validateInput();
27 },
28
validateInput
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
29 validateInput: function ()
30 {
31 this._okButton.disabled = !this._token.checkPassword(this._password.value);
32 },
33
removePassword
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
34 removePassword: function ()
35 {
36 if (this._token.checkPassword(this._password.value)) {
37 this._token.changePassword(this._password.value, "");
38 this._prompt.alert(window,
39 this._bundle.getString("pw_change_success_title"),
40 this._bundle.getString("pw_erased_ok")
41 + " " + this._bundle.getString("pw_empty_warning"));
42 }
43 else {
44 this._password.value = "";
45 this._password.focus();
46 this._prompt.alert(window,
47 this._bundle.getString("pw_change_failed_title"),
48 this._bundle.getString("incorrect_pw"));
49 }
50 },
51 };