~ubuntu-branches/ubuntu/oneiric/enigmail/oneiric-updates

« back to all changes in this revision

Viewing changes to extensions/enigmail/ui/content/enigmailChangePasswd.xul

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2010-04-10 01:42:24 UTC
  • Revision ID: james.westby@ubuntu.com-20100410014224-fbq9ui5x3b0h2t36
Tags: 2:1.0.1-0ubuntu1
* First releaase of enigmail 1.0.1 for tbird/icedove 3
  (LP: #527138)
* redo packaging from scratch 
  + add debian/make-orig target that uses xulrunner provided
    buildsystem + enigmail tarball to produce a proper orig.tar.gz
  + use debhelper 7 with mozilla-devscripts
  + use debian source format 3.0 (quilt)
  + patch enigmail to use frozen API only
    - add debian/patches/frozen_api.diff
  + patch build system to not link against -lxul - which isnt
    available for sdks produced by all-static apps like tbird
    - add debian/patches/build_system_dont_link_libxul.diff
  + add minimal build-depends to control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!--
 
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/
 
6
 
 
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.
 
11
 
 
12
  The Original Code is Enigmail.
 
13
 
 
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.
 
17
  All Rights Reserved.
 
18
 
 
19
  Contributor(s):
 
20
 
 
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
 
31
  GPL.
 
32
-->
 
33
 
 
34
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
 
35
<?xml-stylesheet href="chrome://enigmail/skin/enigmail.css" type="text/css"?>
 
36
 
 
37
<!DOCTYPE window [
 
38
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
 
39
%brandDTD;
 
40
<!ENTITY % enigMailDTD SYSTEM "chrome://enigmail/locale/enigmail.dtd" >
 
41
%enigMailDTD;
 
42
]>
 
43
 
 
44
<dialog id="enigmailChangePwdDlg"
 
45
        title="&enigmail.changePasswd.title;"
 
46
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
 
47
        onload="onLoad()"
 
48
        ondialogaccept="return onAccept();">
 
49
 
 
50
 
 
51
  <script type="application/x-javascript" src="chrome://enigmail/content/enigmailCommon.js"/>
 
52
 
 
53
  <vbox>
 
54
    <label id="userId" value="..."/>
 
55
    <separator/>
 
56
    <grid>
 
57
      <columns>
 
58
        <column/>
 
59
        <column flex="1"/>
 
60
      </columns>
 
61
      <rows>
 
62
        <row align="center">
 
63
          <label value="&enigmail.changePasswd.currPasswd.label; :" control="currPasswd"/>
 
64
          <textbox id="currPasswd" value="" size="20" type="password"/>
 
65
        </row>
 
66
        <row align="center">
 
67
          <label value="&enigmail.changePasswd.newPasswd.label; :" control="newPasswd"/>
 
68
          <textbox id="newPasswd" value="" size="20" type="password"/>
 
69
        </row>
 
70
        <row align="center">
 
71
          <label value="&enigmail.changePasswd.repeatPasswd.label; :" control="repeatPasswd"/>
 
72
          <textbox id="repeatPasswd" value="" size="20" type="password"/>
 
73
        </row>
 
74
      </rows>
 
75
    </grid>
 
76
  </vbox>
 
77
 
 
78
  <script type="application/x-javascript">
 
79
  <![CDATA[
 
80
 
 
81
  EnigInitCommon("enigmailSetCardPinDlg");
 
82
 
 
83
  function onLoad() {
 
84
    var uid = window.window.arguments[0].userId +" - 0x"+ window.arguments[0].keyId.substr(-8,8);
 
85
    document.getElementById("userId").value = uid;
 
86
  }
 
87
 
 
88
  function onAccept() {
 
89
    var enigmailSvc = GetEnigmailSvc();
 
90
    if (!enigmailSvc)
 
91
      return false;
 
92
 
 
93
 
 
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"))) {
 
99
        return false;
 
100
      }
 
101
    }
 
102
    else {
 
103
      if (newPasswd.length < 8) {
 
104
        EnigAlert(EnigGetString("passphrase.min8keys"));
 
105
        return false;
 
106
      }
 
107
      if (newPasswd != repeatPasswd) {
 
108
        EnigAlert(EnigGetString("passNoMatch"));
 
109
        return false;
 
110
      }
 
111
      if (newPasswd.search(/[\x80-\xFF]/)>=0) {
 
112
        EnigAlert(EnigGetString("passCharProblem"));
 
113
        return false;
 
114
      }
 
115
    }
 
116
 
 
117
    var errorMsgObj = new Object();
 
118
 
 
119
    var r = enigmailSvc.changePassphrase(window,
 
120
                                         window.arguments[0].keyId,
 
121
                                         currPasswd,
 
122
                                         newPasswd,
 
123
                                         errorMsgObj);
 
124
 
 
125
    if (r != 0) {
 
126
      EnigAlert(EnigGetString("changePassFailed")+"\n"+errorMsgObj.value);
 
127
      return false;
 
128
    }
 
129
    return true;
 
130
  }
 
131
 
 
132
  function dlgEnable(item) {
 
133
    document.getElementById(item).removeAttribute("collapsed");
 
134
  }
 
135
 
 
136
  function dlgDisable(item) {
 
137
    document.getElementById(item).setAttribute("collapsed", "true");
 
138
  }
 
139
 
 
140
  function setDlgContent(sel) {
 
141
    gAction = sel;
 
142
    switch(sel) {
 
143
    case 'P':
 
144
      dlgDisable("currAdminPinRow");
 
145
      dlgDisable("adminPinRow");
 
146
      dlgDisable("adminPinRepeatRow");
 
147
      dlgEnable("currPinRow");
 
148
      dlgEnable("pinRow");
 
149
      dlgEnable("pinRepeatRow");
 
150
      break;
 
151
    case 'A':
 
152
      dlgEnable("currAdminPinRow");
 
153
      dlgEnable("adminPinRow");
 
154
      dlgEnable("adminPinRepeatRow");
 
155
      dlgDisable("currPinRow");
 
156
      dlgDisable("pinRow");
 
157
      dlgDisable("pinRepeatRow");
 
158
      break;
 
159
    case 'U':
 
160
      dlgEnable("currAdminPinRow");
 
161
      dlgDisable("adminPinRow");
 
162
      dlgDisable("adminPinRepeatRow");
 
163
      dlgDisable("currPinRow");
 
164
      dlgEnable("pinRow");
 
165
      dlgEnable("pinRepeatRow");
 
166
      break;
 
167
    }
 
168
  }
 
169
 
 
170
  function changePinObserver() {
 
171
  }
 
172
 
 
173
  changePinObserver.prototype =
 
174
  {
 
175
    _data: "",
 
176
    result: "",
 
177
 
 
178
    QueryInterface : function(iid)
 
179
    {
 
180
      if (iid.equals(Components.interfaces.nsIEnigMimeReadCallback) ||
 
181
          iid.equals(Components.interfaces.nsISupports) )
 
182
        return this;
 
183
 
 
184
      throw Components.results.NS_NOINTERFACE;
 
185
    },
 
186
 
 
187
    onDataAvailable: function (data) {
 
188
      var ret="";
 
189
      DEBUG_LOG("enigmailSetCardPin: changePinObserver.onDataAvailable: data="+data+"\n");
 
190
      if (data.indexOf("[GNUPG:] SC_OP_FAILURE")>=0) {
 
191
        this.result = this._data;
 
192
      }
 
193
      else {
 
194
        this._data = data
 
195
      }
 
196
      return "";
 
197
    }
 
198
  }
 
199
 
 
200
  ]]>
 
201
  </script>
 
202
</dialog>
 
203
 
 
204