summaryrefslogtreecommitdiff
path: root/ng_selfservice/password.php
blob: a6e67951a0171ec58b201af46291e558369dca6a (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<? $title ='Change Password'; include('elements/header.php'); ?>
<? $current_menu = 'password.php'; include('elements/menu.php'); ?>
<?
$error = '';
$pwd_change_success = false;
if ( isset($_POST['svcnum']) ) {

  $pwd_change_result = $freeside->myaccount_passwd(array(
    'session_id'    => $_COOKIE['session_id'],
    'svcnum'        => $_POST['svcnum'],
    'new_password'  => $_POST['new_password'],
    'new_password2' => $_POST['new_password2'],
  ));

  if ($pwd_change_result['error']) {
    $error = $pwd_change_result['error'];
  } else {
    $pwd_change_success = true;
  }
}

if ($pwd_change_success) {
?>

<P>Password changed for <? echo $pwd_change_result['value'],' ',$pwd_change_result['label'] ?>.</P>

<?
} else {
  $pwd_change_svcs = $freeside->list_svcs(array(
    'session_id' => $_COOKIE['session_id'],
    'svcdb'      => 'svc_acct',
  ));
  if (isset($pwd_change_svcs['error'])) {
    $error = $error || $pwd_change_svcs['error'];
  }
  if (!isset($pwd_change_svcs['svcs'])) {
    $pwd_change_svcs['svcs'] = $pwd_change_svcs['svcs'];
    $error = $error || 'Unknown error loading services';
  }
  if ($error) {
    include('elements/error.php');
  }
?>

<FORM METHOD="POST">
<TABLE BGCOLOR="#cccccc">
  <TR>
    <TH ALIGN="right">Change password for account: </TH>
    <TD>
      <SELECT ID="new_password_svcnum" NAME="svcnum">
<?
  $selected_svcnum = isset($_POST['svcnum']) ? $_POST['svcnum'] : $pwd_change_svcs['svcnum'];
  foreach ($pwd_change_svcs['svcs'] as $svc) {
?>
        <OPTION VALUE="<? echo $svc['svcnum'] ?>"<? echo $selected_svcnum == $svc['svcnum'] ? ' SELECTED' : '' ?>>
          <? echo $svc['label'],': ',$svc['value'] ?>
        </OPTION>
<?
  }
?>
      </SELECT>
    </TD>
  </TR>

  <TR>
    <TH ALIGN="right">New password: </TH>
    <TD>
      <INPUT ID="new_password" TYPE="password" NAME="new_password" SIZE="18">
      <DIV ID="new_password_result"></DIV>
<? include('elements/add_password_validation.php'); ?>
      <SCRIPT>add_password_validation('new_password');</SCRIPT>
    </TD>
  </TR>

  <TR>
    <TH ALIGN="right">Re-enter new password: </TH>
    <TD><INPUT TYPE="password" NAME="new_password2" SIZE="18"></TD>
  </TR>

</TABLE>
<BR>

<INPUT TYPE="submit" VALUE="Change password">

</FORM>

<?
} // end if $pwd_change_show_form
?>

<? include('elements/menu_footer.php'); ?>
<? include('elements/footer.php'); ?>