v4 style
[freeside.git] / httemplate / elements / change_password.html
1 <STYLE>
2 .passwordbox {
3   border: 1px solid #7e0079;
4   padding: 2px;
5   position: absolute;
6   font-size: 80%;
7   background-color: #ffffff;
8   display: none;
9 }
10 </STYLE>
11 % if (!$opt{'no_label_display'}) {
12 <A ID="<%$pre%>link" HREF="javascript:void(0)" onclick="<%$pre%>toggle(true)">(<% emt( $change_title ) %>)</A>
13 % }
14 <DIV ID="<%$pre%>div" CLASS="passwordbox">
15 % if (!$opt{'noformtag'}) {
16   <FORM ID="<%$pre%>form" METHOD="POST" ACTION="<%$fsurl%>misc/process/change-password.html" onsubmit="return <%$pre%>checkPasswordValidation()">
17 % }
18
19     <% $change_id_input %>
20     <INPUT TYPE="text" ID="<%$pre%>password" NAME="<% $opt{'pre_pwd_field_label'} %>password" VALUE="<% $curr_value |h%>">
21     <& /elements/random_pass.html, $pre.'password', 'randomize', $change_button_id &>
22 % if (!$opt{'noformtag'}) {
23     <INPUT TYPE="submit" ID="<%$change_button_id%>" VALUE="change" disabled="disabled">
24 % } else {
25     <INPUT TYPE="button" ID="<%$change_button_id%>" VALUE="change" onclick="<%$pre%>toggle(false)" disabled="disabled">
26 %}
27     <INPUT TYPE="button" ID="<%$pre%>cancel_button" VALUE="cancel" onclick="<%$pre%>toggle(false, true)">
28
29     <DIV ID="<%$pre%>password_result" STYLE="font-size: smaller"></DIV>
30     <& '/elements/validate_password.html', 
31          'fieldid'    => $pre.'password',
32          'svcnum'     => $svcnum,
33          'contactnum' => $opt{'contact_num'},
34          'submitid'   => $change_button_id,
35     &>
36
37 % if (!$opt{'noformtag'}) {
38   </FORM>
39 % }
40
41 </DIV>
42 <SCRIPT TYPE="text/javascript">
43 function <%$pre%>toggle(toggle, clear) {
44   if (clear) {
45     document.getElementById('<%$pre%>password').value = '';
46     document.getElementById('<%$pre%>password_result').innerHTML = '';
47     document.getElementById('<%$change_button_id%>').disabled = true;
48   }
49   document.getElementById('<%$pre%>div').style.display =
50     toggle ? 'inline-block' : 'none';
51 % if (!$opt{'no_label_display'}) {
52   document.getElementById('<%$pre%>link').style.display =
53     toggle ? 'none' : 'inline';
54 % }
55 }
56
57 function <%$pre%>checkPasswordValidation(resultId)  {
58   var validationResult = document.getElementById('<%$pre%>password_result').innerHTML;
59   if (validationResult.match(/Password valid!/)) {
60     return true;
61   }
62   else {
63     return false;
64   }
65 }
66 </SCRIPT>
67 <%init>
68 my %opt = @_;
69
70 my $curr_value = $opt{'curr_value'} || '';
71 my $change_title = $opt{'label'} || 'change';
72 my $svcnum;
73 my $change_id_input = '';
74 my $pre = 'changepw';
75
76 if ($opt{'svc_acct'}) {
77   my $svc_acct = $opt{'svc_acct'};
78   $change_id_input = '<INPUT TYPE="hidden" NAME="'.$opt{'pre_pwd_field_label'}.'svcnum" VALUE="' . $svc_acct->svcnum . '">';
79   $pre .= $svc_acct->svcnum . '_';
80   $svcnum = $svc_acct->svcnum;
81 }
82 elsif ($opt{'contact_num'}) {
83   $change_id_input = '
84     <INPUT TYPE="hidden" NAME="contactnum" VALUE="' . $opt{'contact_num'} . '">
85     <INPUT TYPE="hidden" NAME="custnum" VALUE="' . $opt{'custnum'} . '">
86   ';
87   $pre .= $opt{'pre_pwd_field_label'};
88 }
89
90 my $change_button_id = $pre.'change_button';
91
92  my $error = $cgi->param($pre.'error');
93 </%init>