summaryrefslogtreecommitdiff
path: root/httemplate/elements/change_password.html
blob: b3a432f95f8b50083150dd1e6be861d3c193bfb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<STYLE>
.passwordbox {
  border: 1px solid #7e0079;
  padding: 2px;
  position: absolute;
  font-size: 80%;
  background-color: #ffffff;
  display: none;
}
</STYLE>
<A ID="<%$pre%>link" HREF="javascript:void(0)" onclick="<%$pre%>toggle(true)">(<% emt( $change_title ) %>)</A>
<DIV ID="<%$pre%>form" CLASS="passwordbox">
  <FORM METHOD="POST" ACTION="<%$fsurl%>misc/process/change-password.html">
    <% $change_id_input %>
    <INPUT TYPE="text" ID="<%$pre%>password" NAME="password" VALUE="<% $curr_value |h%>">
    <& /elements/random_pass.html, $pre.'password', 'randomize' &>
    <INPUT TYPE="submit" VALUE="change">
    <INPUT TYPE="button" VALUE="cancel" onclick="<%$pre%>toggle(false)">
    <DIV ID="<%$pre%>password_result" STYLE="font-size: smaller"></DIV>
    <& '/elements/validate_password.html', 
         'fieldid'    => $pre.'password',
         'svcnum'     => $svcnum,
         'contactnum' => $contactnum,
    &>
% if ( $error ) {
    <BR><SPAN STYLE="color: #ff0000"><% $error |h %></SPAN>
% }
  </FORM>
</DIV>
<SCRIPT TYPE="text/javascript">
function <%$pre%>toggle(val) {
  document.getElementById('<%$pre%>form').style.display =
    val ? 'inline-block' : 'none';
  document.getElementById('<%$pre%>link').style.display =
    val ? 'none' : 'inline';
}
% if ( $error ) {
<%$pre%>toggle(true);
% }
</SCRIPT>
<%init>
my %opt = @_;

my $contactnum = $opt{'contact_num'};
my $curr_value = $opt{'curr_value'} || '';
my $change_title = $opt{'label'} || 'change';

my $svcnum;
my $change_id_input = '';
my $pre = 'changepw';

if ($opt{'svc_acct'}) {
  my $svc_acct = $opt{'svc_acct'};
  $change_id_input = '<INPUT TYPE="hidden" NAME="svcnum" VALUE="' . $svc_acct->svcnum . '">';
  $pre .= $svc_acct->svcnum . '_';
  $svcnum = $svc_acct->svcnum;
}
elsif ($opt{'contact_num'}) {
  $change_id_input = '
    <INPUT TYPE="hidden" NAME="contactnum" VALUE="' . $opt{'contact_num'} . '">
    <INPUT TYPE="hidden" NAME="custnum" VALUE="' . $opt{'custnum'} . '">
  ';
  $pre .= $opt{'contact_num'} . '_';
}

 my $error = $cgi->param($pre.'error');
</%init>