RT# 81830 Critical log event for corrupted invoice data
[freeside.git] / ng_selfservice / password.php
1 <? $title ='Change Password'; include('elements/header.php'); ?>
2 <? $current_menu = 'password.php'; include('elements/menu.php'); ?>
3 <?
4 $error = '';
5 $pwd_change_success = false;
6 if ( isset($_POST['svcnum']) ) {
7
8   $pwd_change_result = $freeside->myaccount_passwd(array(
9     'session_id'    => $_COOKIE['session_id'],
10     'svcnum'        => $_POST['svcnum'],
11     'new_password'  => $_POST['new_password'],
12     'new_password2' => $_POST['new_password2'],
13   ));
14
15   if ($pwd_change_result['error']) {
16     $error = $pwd_change_result['error'];
17   } else {
18     $pwd_change_success = true;
19   }
20 }
21
22 if ($pwd_change_success) {
23 ?>
24
25 <P>Password changed for <? echo $pwd_change_result['value'],' ',$pwd_change_result['label'] ?>.</P>
26
27 <?
28 } else {
29   $pwd_change_svcs = $freeside->list_svcs(array(
30     'session_id' => $_COOKIE['session_id'],
31     'svcdb'      => 'svc_acct',
32   ));
33   if (isset($pwd_change_svcs['error'])) {
34     $error = $error || $pwd_change_svcs['error'];
35   }
36   if (!isset($pwd_change_svcs['svcs'])) {
37     $pwd_change_svcs['svcs'] = $pwd_change_svcs['svcs'];
38     $error = $error || 'Unknown error loading services';
39   }
40   if ($error) {
41     include('elements/error.php');
42   }
43 ?>
44
45 <FORM METHOD="POST">
46 <TABLE BGCOLOR="#cccccc">
47   <TR>
48     <TH ALIGN="right">Change password for account: </TH>
49     <TD>
50       <SELECT ID="new_password_svcnum" NAME="svcnum">
51 <?
52   $selected_svcnum = isset($_POST['svcnum']) ? $_POST['svcnum'] : $pwd_change_svcs['svcnum'];
53   foreach ($pwd_change_svcs['svcs'] as $svc) {
54 ?>
55         <OPTION VALUE="<? echo $svc['svcnum'] ?>"<? echo $selected_svcnum == $svc['svcnum'] ? ' SELECTED' : '' ?>>
56           <? echo $svc['label'],': ',$svc['value'] ?>
57         </OPTION>
58 <?
59   }
60 ?>
61       </SELECT>
62     </TD>
63   </TR>
64
65   <TR>
66     <TH ALIGN="right">New password: </TH>
67     <TD>
68       <INPUT ID="new_password" TYPE="password" NAME="new_password" SIZE="18">
69       <DIV ID="new_password_result"></DIV>
70 <? include('elements/add_password_validation.php'); ?>
71       <SCRIPT>add_password_validation('new_password');</SCRIPT>
72     </TD>
73   </TR>
74
75   <TR>
76     <TH ALIGN="right">Re-enter new password: </TH>
77     <TD><INPUT TYPE="password" NAME="new_password2" SIZE="18"></TD>
78   </TR>
79
80 </TABLE>
81 <BR>
82
83 <INPUT TYPE="submit" VALUE="Change password">
84
85 </FORM>
86
87 <?
88 } // end if $pwd_change_show_form
89 ?>
90
91 <? include('elements/menu_footer.php'); ?>
92 <? include('elements/footer.php'); ?>