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.'edit/cust_main-contacts.html?'.$cgi->param('custnum')) %>
25 <& /elements/header-popup.html, 'Password Set' &>
26 <SCRIPT TYPE="text/javascript">
32 my $curuser = $FS::CurrentUser::CurrentUser;
34 $cgi->param('svcnum') =~ /^(\d+)$/ or die "illegal svcnum" if $cgi->param('svcnum');
37 $cgi->param('contactnum') =~ /^(\d+)$/ or die "illegal contactnum" if $cgi->param('contactnum');
40 my $popup = $cgi->param('popup');
42 my $newpass = $cgi->param('password');
47 my $svc_acct = FS::svc_acct->by_key($svcnum)
48 or die "svc_acct $svcnum not found";
49 my $part_svc = $svc_acct->part_svc;
50 die "access denied" unless (
51 $curuser->access_right('Provision customer service') or
52 ( $curuser->access_right('Edit password') and
53 ! $part_svc->restrict_edit_password )
56 $error = $svc_acct->is_password_allowed($newpass)
57 || $svc_acct->set_password($newpass)
58 || $svc_acct->replace;
60 # annoyingly specific to view/svc_acct.cgi, for now...
61 $cgi->delete('password');
64 my $contact = qsearchs('contact', { 'contactnum' => $contactnum } )
65 or return { 'error' => "Contact not found" . $contactnum };
67 $error = $contact->is_password_allowed($newpass)
68 || $contact->change_password($newpass);
70 # annoyingly specific to view/svc_acct.cgi, for now...
71 #$cgi->delete('password');