Option to ignore old CDRs, RT#81480
[freeside.git] / httemplate / misc / process / change-password.html
index be83786..1c746a4 100644 (file)
@@ -7,6 +7,7 @@
 %              $cgi->param('contactnum', $contactnum);
 %              $cgi->param("changepw${contactnum}_error", $error);
 %      }
+%    $cgi->param('error', $error);
 % } else {
 %      if ($svcnum) { $cgi->query_string($svcnum); }
 %      elsif ($contactnum) { $cgi->query_string($contactnum); }
         <% $cgi->redirect($fsurl.'view/svc_acct.cgi?'.$cgi->query_string) %>
 %   }
 %   elsif ($contactnum) { 
-        <% $cgi->redirect($fsurl.'edit/cust_main-contacts.html?'.$cgi->param('custnum')) %>
+%     my $freeside_status = "Contact ".$contact->{'Hash'}->{'first'}." ".$contact->{'Hash'}->{'last'}." password updated.";
+        <% $cgi->redirect( -uri    => popurl(3). "view/cust_main.cgi?". $cgi->param('custnum'),
+                   -cookie => CGI::Cookie->new(
+                     -name    => 'freeside_status',
+                     -value   => mt($freeside_status),
+                     -expires => '+5m',
+                   ),
+   )
+%>
 %   }
 % }
 
 
 <%init>
 my $curuser = $FS::CurrentUser::CurrentUser;
+my $contact;
 
 $cgi->param('svcnum') =~ /^(\d+)$/ or die "illegal svcnum" if $cgi->param('svcnum');
 my $svcnum = $1;
 
+foreach my $prefix (grep /^(.*)(password)$/, $cgi->param) {
+     $cgi->param('password' => $cgi->param($prefix));
+}
+
 $cgi->param('contactnum') =~ /^(\d+)$/ or die "illegal contactnum" if $cgi->param('contactnum');
 my $contactnum = $1;
 
@@ -52,7 +66,7 @@ if ($svcnum) {
            ! $part_svc->restrict_edit_password )
          );
 
-       my $error = $svc_acct->is_password_allowed($newpass)
+       $error = $svc_acct->is_password_allowed($newpass)
                ||  $svc_acct->set_password($newpass)
                ||  $svc_acct->replace;
 
@@ -60,10 +74,10 @@ if ($svcnum) {
        $cgi->delete('password');
 }
 elsif ($contactnum) {
-       my $contact = qsearchs('contact', { 'contactnum' => $contactnum } )
+       $contact = qsearchs('contact', { 'contactnum' => $contactnum } )
       or return { 'error' => "Contact not found" . $contactnum };
 
-       my $error = $contact->is_password_allowed($newpass)
+       $error = $contact->is_password_allowed($newpass)
                ||  $contact->change_password($newpass);
 
        # annoyingly specific to view/svc_acct.cgi, for now...