a8cc883b9eb5276bd2e35690752b44a34ee22afb
[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 <A ID="<%$pre%>link" HREF="javascript:void(0)" onclick="<%$pre%>toggle(true)">(<% emt( $change_title ) %>)</A>
12 <DIV ID="<%$pre%>form" CLASS="passwordbox">
13   <FORM METHOD="POST" ACTION="<%$fsurl%>misc/process/change-password.html">
14     <% $change_id_input %>
15     <INPUT TYPE="text" ID="<%$pre%>password" NAME="password" VALUE="<% $curr_value |h%>">
16     <& /elements/random_pass.html, $pre.'password', 'randomize' &>
17     <INPUT TYPE="submit" VALUE="change">
18 % if ($opt{'popup'}) {
19     <INPUT TYPE="button" VALUE="cancel" onclick="parent.cClick();">
20 % }
21 % else {
22     <INPUT TYPE="button" VALUE="cancel" onclick="<%$pre%>toggle(false)">  
23 %}
24     <DIV ID="<%$pre%>password_result" STYLE="font-size: smaller"></DIV>
25     <& '/elements/validate_password.html', 
26          'fieldid'    => $pre.'password',
27          'svcnum'     => $svcnum,
28          'contactnum' => $contactnum,
29     &>
30 % if ( $error ) {
31     <BR><SPAN STYLE="color: #ff0000"><% $error |h %></SPAN>
32 % }
33   </FORM>
34 </DIV>
35 <SCRIPT TYPE="text/javascript">
36 function <%$pre%>toggle(val) {
37   document.getElementById('<%$pre%>form').style.display =
38     val ? 'inline-block' : 'none';
39   document.getElementById('<%$pre%>link').style.display =
40     val ? 'none' : 'inline';
41 }
42 % if ( $error || $opt{'popup'} ) {
43 <%$pre%>toggle(true);
44 % }
45 </SCRIPT>
46 <%init>
47 my %opt = @_;
48
49 my $contactnum = $opt{'contact_num'};
50 my $curr_value = $opt{'curr_value'} || '';
51 my $change_title = $opt{'label'} || 'change';
52
53 my $svcnum;
54 my $change_id_input = '';
55 my $pre = 'changepw';
56
57 if ($opt{'svc_acct'}) {
58   my $svc_acct = $opt{'svc_acct'};
59   $change_id_input = '<INPUT TYPE="hidden" NAME="svcnum" VALUE="' . $svc_acct->svcnum . '">';
60   $pre .= $svc_acct->svcnum . '_';
61   $svcnum = $svc_acct->svcnum;
62 }
63 elsif ($opt{'contact_num'}) {
64   $change_id_input = '
65     <INPUT TYPE="hidden" NAME="contactnum" VALUE="' . $opt{'contact_num'} . '">
66     <INPUT TYPE="hidden" NAME="custnum" VALUE="' . $opt{'custnum'} . '">
67   ';
68   $pre .= $opt{'contact_num'} . '_';
69 }
70
71 if ($opt{'popup'}) {
72   $change_id_input .= '<INPUT TYPE="hidden" NAME="popup" VALUE="' . $opt{'popup'} . '">';
73 }
74
75  my $error = $cgi->param($pre.'error');
76 </%init>