2
The contents of this file are subject to the Mozilla Public
3
License Version 1.1 (the "MPL"); you may not use this file
4
except in compliance with the MPL. You may obtain a copy of
5
the MPL at http://www.mozilla.org/MPL/
7
Software distributed under the MPL is distributed on an "AS
8
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9
implied. See the MPL for the specific language governing
10
rights and limitations under the MPL.
12
The Original Code is Enigmail.
14
The Initial Developer of this code is Patrick Brunschwig.
15
Portions created by Patrick Brunschwig <patrick.brunschwig@gmx.net>
16
are Copyright (C) 2005 Patrick Brunschwig.
21
Alternatively, the contents of this file may be used under the
22
terms of the GNU General Public License (the "GPL"), in which case
23
the provisions of the GPL are applicable instead of
24
those above. If you wish to allow use of your version of this
25
file only under the terms of the GPL and not to allow
26
others to use your version of this file under the MPL, indicate
27
your decision by deleting the provisions above and replace them
28
with the notice and other provisions required by the GPL.
29
If you do not delete the provisions above, a recipient
30
may use your version of this file under either the MPL or the
34
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
35
<?xml-stylesheet href="chrome://enigmail/skin/enigmail.css" type="text/css"?>
38
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
40
<!ENTITY % enigMailDTD SYSTEM "chrome://enigmail/locale/enigmail.dtd" >
44
<dialog id="enigmailSetCardPingDlg"
45
title="&enigmail.cardPin.title;"
46
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
48
ondialogaccept="return onAccept();"
52
<script type="application/x-javascript" src="chrome://enigmail/content/enigmailCommon.js"/>
57
<label value="&enigmail.cardPin.action.label;" control="actionMenu"/>
58
<menulist id="actionMenu" label="&enigmail.cardPin.changePin.label;" value="P">
59
<menupopup id="actionMenuPopup">
60
<menuitem id="changePin"
61
label="&enigmail.cardPin.changePin.label;"
63
oncommand="setDlgContent('P')"/>
64
<menuitem id="changeAPin"
65
label="&enigmail.cardPin.changeAdmPin.label;"
66
oncommand="setDlgContent('A')"/>
67
<menuitem id="unblockPin"
68
label="&enigmail.cardPin.unblockPin.label;"
69
oncommand="setDlgContent('U')"/>
80
<row align="center" id="currAdminPinRow" collapsed="true">
81
<label value="&enigmail.cardPin.currAdmPin.label; :" type="password" control="currAdmPinTxt"/>
82
<textbox id="currAdmPinTxt" value="" type="password"/>
84
<row align="center" id="adminPinRow" collapsed="true">
85
<label value="&enigmail.cardPin.newAdminPin.label; :" control="adminPinTxt"/>
86
<textbox id="adminPinTxt" value="" type="password"/>
88
<row align="center" id="adminPinRepeatRow" collapsed="true">
89
<label value="&enigmail.cardPin.adminPinRepeat.label; :" control="adminPinRepeatTxt"/>
90
<textbox id="adminPinRepeatTxt" value="" type="password"/>
92
<row align="center" id="currPinRow">
93
<label value="&enigmail.cardPin.currPin.label; :" control="currPinTxt"/>
94
<textbox id="currPinTxt" value="" type="password"/>
96
<row align="center" id="pinRow">
97
<label value="&enigmail.cardPin.newPin.label; :" control="pinTxt"/>
98
<textbox id="pinTxt" value="" type="password"/>
100
<row align="center" id="pinRepeatRow">
101
<label value="&enigmail.cardPin.pinRepeat.label; :" control="pinRepeatTxt"/>
102
<textbox id="pinRepeatTxt" value="" type="password"/>
108
<script type="application/x-javascript">
111
EnigInitCommon("enigmailSetCardPinDlg");
113
const CHANGE_PIN = 'P';
114
const ADMIN_PIN = 'A';
115
const UNBLOCK_PIN = 'U';
120
setDlgContent(CHANGE_PIN);
123
function onAccept() {
124
var enigmailSvc = GetEnigmailSvc();
136
pinItem2="pinRepeatTxt";
138
action = nsIEnigmail.CARD_PIN_CHANGE;
142
pinItem2="pinRepeatTxt";
144
action = nsIEnigmail.CARD_PIN_UNBLOCK;
147
pinItem1="adminPinTxt";
148
pinItem2="adminPinRepeatTxt";
150
action = nsIEnigmail.CARD_ADMIN_PIN_CHANGE;
153
var adminPin = document.getElementById("currAdmPinTxt").value;
154
var oldPin = document.getElementById("currPinTxt").value;
155
var newPin = document.getElementById(pinItem1).value;
156
if (newPin.length < minLen) {
157
EnigAlert(EnigGetString("cardPin.minLength", minLen));
160
if (newPin != document.getElementById(pinItem2).value) {
161
EnigAlert(EnigGetString("cardPin.dontMatch"));
165
var errorMsgObj = new Object();
166
var pinObserver = new changePinObserver();
168
var r = enigmailSvc.cardChangePin(window,
177
EnigAlert(EnigGetString("cardPin.processFailed")+"\n"+pinObserver.result);
183
function dlgEnable(item) {
184
document.getElementById(item).removeAttribute("collapsed");
187
function dlgDisable(item) {
188
document.getElementById(item).setAttribute("collapsed", "true");
191
function setDlgContent(sel) {
195
dlgDisable("currAdminPinRow");
196
dlgDisable("adminPinRow");
197
dlgDisable("adminPinRepeatRow");
198
dlgEnable("currPinRow");
200
dlgEnable("pinRepeatRow");
203
dlgEnable("currAdminPinRow");
204
dlgEnable("adminPinRow");
205
dlgEnable("adminPinRepeatRow");
206
dlgDisable("currPinRow");
207
dlgDisable("pinRow");
208
dlgDisable("pinRepeatRow");
211
dlgEnable("currAdminPinRow");
212
dlgDisable("adminPinRow");
213
dlgDisable("adminPinRepeatRow");
214
dlgDisable("currPinRow");
216
dlgEnable("pinRepeatRow");
221
function changePinObserver() {
224
changePinObserver.prototype =
229
QueryInterface : function(iid)
231
if (iid.equals(Components.interfaces.nsIEnigMimeReadCallback) ||
232
iid.equals(Components.interfaces.nsISupports) )
235
throw Components.results.NS_NOINTERFACE;
238
onDataAvailable: function (data) {
240
DEBUG_LOG("enigmailSetCardPin: changePinObserver.onDataAvailable: data="+data+"\n");
241
if (data.indexOf("[GNUPG:] SC_OP_FAILURE")>=0) {
242
this.result = this._data;