3 % $cgi->param('svcnum', $svcnum);
4 % $cgi->param("changepw${svcnum}_error", $error);
6 % elsif ($contactnum) {
7 % $cgi->param('contactnum', $contactnum);
8 % $cgi->param("changepw${contactnum}_error", $error);
10 % $cgi->param('error', $error);
12 % if ($svcnum) { $cgi->query_string($svcnum); }
13 % elsif ($contactnum) { $cgi->query_string($contactnum); }
18 <% $cgi->redirect($fsurl.'view/svc_acct.cgi?'.$cgi->query_string) %>
20 % elsif ($contactnum) {
21 <% $cgi->redirect($fsurl.'view/cust_main.cgi?'.$cgi->param('custnum')) %>
25 <& /elements/header-popup.html, 'Password Set' &>
26 <SCRIPT TYPE="text/javascript">
32 my $curuser = $FS::CurrentUser::CurrentUser;
35 $cgi->param('svcnum') =~ /^(\d+)$/ or die "illegal svcnum" if $cgi->param('svcnum');
38 foreach my $prefix (grep /^(.*)(password)$/, $cgi->param) {
39 $cgi->param('password' => $cgi->param($prefix));
42 $cgi->param('contactnum') =~ /^(\d+)$/ or die "illegal contactnum" if $cgi->param('contactnum');
45 my $popup = $cgi->param('popup');
47 my $newpass = $cgi->param('password');
52 my $svc_acct = FS::svc_acct->by_key($svcnum)
53 or die "svc_acct $svcnum not found";
54 my $part_svc = $svc_acct->part_svc;
55 die "access denied" unless (
56 $curuser->access_right('Provision customer service') or
57 ( $curuser->access_right('Edit password') and
58 ! $part_svc->restrict_edit_password )
61 $error = $svc_acct->is_password_allowed($newpass)
62 || $svc_acct->set_password($newpass)
63 || $svc_acct->replace;
65 # annoyingly specific to view/svc_acct.cgi, for now...
66 $cgi->delete('password');
69 $contact = qsearchs('contact', { 'contactnum' => $contactnum } )
70 or return { 'error' => "Contact not found" . $contactnum };
72 $error = $contact->is_password_allowed($newpass)
73 || $contact->change_password($newpass);
75 # annoyingly specific to view/svc_acct.cgi, for now...
76 #$cgi->delete('password');