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);
11 % if ($svcnum) { $cgi->query_string($svcnum); }
12 % elsif ($contactnum) { $cgi->query_string($contactnum); }
17 <% $cgi->redirect($fsurl.'view/svc_acct.cgi?'.$cgi->query_string) %>
19 % elsif ($contactnum) {
20 <% $cgi->redirect($fsurl.'edit/cust_main-contacts.html?'.$cgi->param('custnum')) %>
24 <& /elements/header-popup.html, 'Password Set' &>
25 <SCRIPT TYPE="text/javascript">
31 my $curuser = $FS::CurrentUser::CurrentUser;
33 $cgi->param('svcnum') =~ /^(\d+)$/ or die "illegal svcnum" if $cgi->param('svcnum');
36 $cgi->param('contactnum') =~ /^(\d+)$/ or die "illegal contactnum" if $cgi->param('contactnum');
39 my $popup = $cgi->param('popup');
41 my $newpass = $cgi->param('password');
46 my $svc_acct = FS::svc_acct->by_key($svcnum)
47 or die "svc_acct $svcnum not found";
48 my $part_svc = $svc_acct->part_svc;
49 die "access denied" unless (
50 $curuser->access_right('Provision customer service') or
51 ( $curuser->access_right('Edit password') and
52 ! $part_svc->restrict_edit_password )
55 my $error = $svc_acct->is_password_allowed($newpass)
56 || $svc_acct->set_password($newpass)
57 || $svc_acct->replace;
59 # annoyingly specific to view/svc_acct.cgi, for now...
60 $cgi->delete('password');
63 my $contact = qsearchs('contact', { 'contactnum' => $contactnum } )
64 or return { 'error' => "Contact not found" . $contactnum };
66 my $error = $contact->is_password_allowed($newpass)
67 || $contact->change_password($newpass);
69 # annoyingly specific to view/svc_acct.cgi, for now...
70 #$cgi->delete('password');