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="enigmailChangePwdDlg"
45
title="&enigmail.changePasswd.title;"
46
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
48
ondialogaccept="return onAccept();">
51
<script type="application/x-javascript" src="chrome://enigmail/content/enigmailCommon.js"/>
54
<label id="userId" value="..."/>
63
<label value="&enigmail.changePasswd.currPasswd.label; :" control="currPasswd"/>
64
<textbox id="currPasswd" value="" size="20" type="password"/>
67
<label value="&enigmail.changePasswd.newPasswd.label; :" control="newPasswd"/>
68
<textbox id="newPasswd" value="" size="20" type="password"/>
71
<label value="&enigmail.changePasswd.repeatPasswd.label; :" control="repeatPasswd"/>
72
<textbox id="repeatPasswd" value="" size="20" type="password"/>
78
<script type="application/x-javascript">
81
EnigInitCommon("enigmailSetCardPinDlg");
84
var uid = window.window.arguments[0].userId +" - 0x"+ window.arguments[0].keyId.substr(-8,8);
85
document.getElementById("userId").value = uid;
89
var enigmailSvc = GetEnigmailSvc();
94
var currPasswd = document.getElementById("currPasswd").value;
95
var newPasswd = document.getElementById("newPasswd").value;
96
var repeatPasswd = document.getElementById("repeatPasswd").value;
97
if (newPasswd.length == 0 && repeatPasswd.length == 0) {
98
if (! EnigConfirm(EnigGetString("removePassphrase"), EnigGetString("keyMan.button.removePass"))) {
103
if (newPasswd.length < 8) {
104
EnigAlert(EnigGetString("passphrase.min8keys"));
107
if (newPasswd != repeatPasswd) {
108
EnigAlert(EnigGetString("passNoMatch"));
111
if (newPasswd.search(/[\x80-\xFF]/)>=0) {
112
EnigAlert(EnigGetString("passCharProblem"));
117
var errorMsgObj = new Object();
119
var r = enigmailSvc.changePassphrase(window,
120
window.arguments[0].keyId,
126
EnigAlert(EnigGetString("changePassFailed")+"\n"+errorMsgObj.value);
132
function dlgEnable(item) {
133
document.getElementById(item).removeAttribute("collapsed");
136
function dlgDisable(item) {
137
document.getElementById(item).setAttribute("collapsed", "true");
140
function setDlgContent(sel) {
144
dlgDisable("currAdminPinRow");
145
dlgDisable("adminPinRow");
146
dlgDisable("adminPinRepeatRow");
147
dlgEnable("currPinRow");
149
dlgEnable("pinRepeatRow");
152
dlgEnable("currAdminPinRow");
153
dlgEnable("adminPinRow");
154
dlgEnable("adminPinRepeatRow");
155
dlgDisable("currPinRow");
156
dlgDisable("pinRow");
157
dlgDisable("pinRepeatRow");
160
dlgEnable("currAdminPinRow");
161
dlgDisable("adminPinRow");
162
dlgDisable("adminPinRepeatRow");
163
dlgDisable("currPinRow");
165
dlgEnable("pinRepeatRow");
170
function changePinObserver() {
173
changePinObserver.prototype =
178
QueryInterface : function(iid)
180
if (iid.equals(Components.interfaces.nsIEnigMimeReadCallback) ||
181
iid.equals(Components.interfaces.nsISupports) )
184
throw Components.results.NS_NOINTERFACE;
187
onDataAvailable: function (data) {
189
DEBUG_LOG("enigmailSetCardPin: changePinObserver.onDataAvailable: data="+data+"\n");
190
if (data.indexOf("[GNUPG:] SC_OP_FAILURE")>=0) {
191
this.result = this._data;