[freeside-commits] freeside/httemplate/edit/process svc_acct.cgi, 1.11.4.1, 1.11.4.2

Ivan,,, ivan at wavetail.420.am
Tue Jan 26 02:05:12 PST 2010


Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail.420.am:/tmp/cvs-serv8830/httemplate/edit/process

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	svc_acct.cgi 
Log Message:
more fallout from default pw encryption: fix error reporting when entering a bad password

Index: svc_acct.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/svc_acct.cgi,v
retrieving revision 1.11.4.1
retrieving revision 1.11.4.2
diff -u -d -r1.11.4.1 -r1.11.4.2
--- svc_acct.cgi	23 Dec 2009 00:30:26 -0000	1.11.4.1
+++ svc_acct.cgi	26 Jan 2010 10:05:10 -0000	1.11.4.2
@@ -11,7 +11,6 @@
 
 $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
 my $svcnum = $1;
-my $error;
 
 my $old;
 if ( $svcnum ) {
@@ -40,27 +39,31 @@
   } (fields('svc_acct'), qw ( pkgnum svcpart usergroup ));
 my $new = new FS::svc_acct ( \%hash );
 
+my $error = '';
+
 $new->_password($old->_password) if $old;
-if(  $cgi->param('clear_password') eq '*HIDDEN*'
-  or $cgi->param('clear_password') =~ /^\(.* encrypted\)$/ ) {
+if (     $cgi->param('clear_password') eq '*HIDDEN*'
+      || $cgi->param('clear_password') =~ /^\(.* encrypted\)$/ ) {
   die "fatal: no previous account to recall hidden password from!" unless $old;
-} 
-else {
+} else {
   $error = $new->set_password($cgi->param('clear_password'));
 }
 
 if ( $svcnum ) {
-  foreach (grep { $old->$_ != $new->$_ } qw( seconds upbytes downbytes totalbytes )) {
+  foreach ( grep { $old->$_ != $new->$_ }
+                 qw( seconds upbytes downbytes totalbytes )
+          )
+  {
     my %hash = map { $_ => $new->$_ } 
                grep { $new->$_ }
                qw( seconds upbytes downbytes totalbytes );
 
-    $error = $new->set_usage(\%hash);  #unoverlimit and trigger radius changes
-    last;                              #once is enough
+    $error ||= $new->set_usage(\%hash);  #unoverlimit and trigger radius changes
+    last;                                #once is enough
   }
   $error ||= $new->replace($old);
 } else {
-  $error = $new->insert;
+  $error ||= $new->insert;
   $svcnum = $new->svcnum;
 }
 



More information about the freeside-commits mailing list