RT# 75817 - Added the ability to set contacts password on the backend
[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     <INPUT TYPE="button" VALUE="cancel" onclick="<%$pre%>toggle(false)">
19     <DIV ID="<%$pre%>password_result" STYLE="font-size: smaller"></DIV>
20     <& '/elements/validate_password.html', 
21          'fieldid'    => $pre.'password',
22          'svcnum'     => $svcnum,
23          'contactnum' => $contactnum,
24     &>
25 % if ( $error ) {
26     <BR><SPAN STYLE="color: #ff0000"><% $error |h %></SPAN>
27 % }
28   </FORM>
29 </DIV>
30 <SCRIPT TYPE="text/javascript">
31 function <%$pre%>toggle(val) {
32   document.getElementById('<%$pre%>form').style.display =
33     val ? 'inline-block' : 'none';
34   document.getElementById('<%$pre%>link').style.display =
35     val ? 'none' : 'inline';
36 }
37 % if ( $error ) {
38 <%$pre%>toggle(true);
39 % }
40 </SCRIPT>
41 <%init>
42 my %opt = @_;
43
44 my $contactnum = $opt{'contact_num'};
45 my $curr_value = $opt{'curr_value'} || '';
46 my $change_title = $opt{'label'} || 'change';
47
48 my $svcnum;
49 my $change_id_input = '';
50 my $pre = 'changepw';
51
52 if ($opt{'svc_acct'}) {
53   my $svc_acct = $opt{'svc_acct'};
54   $change_id_input = '<INPUT TYPE="hidden" NAME="svcnum" VALUE="' . $svc_acct->svcnum . '">';
55   $pre .= $svc_acct->svcnum . '_';
56   $svcnum = $svc_acct->svcnum;
57 }
58 elsif ($opt{'contact_num'}) {
59   $change_id_input = '
60     <INPUT TYPE="hidden" NAME="contactnum" VALUE="' . $opt{'contact_num'} . '">
61     <INPUT TYPE="hidden" NAME="custnum" VALUE="' . $opt{'custnum'} . '">
62   ';
63   $pre .= $opt{'contact_num'} . '_';
64 }
65
66  my $error = $cgi->param($pre.'error');
67 </%init>