Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / edit / process / svc_acct.cgi
index ca614cb..d75ff92 100755 (executable)
@@ -81,7 +81,12 @@ 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 {
-  $error ||= $new->set_password($cgi->param('clear_password'));
+  my $newpass = $cgi->param('clear_password');
+  if ( ! $old->check_password($newpass) ) {
+    # then the password is being changed
+    $error ||= $new->is_password_allowed($newpass)
+           ||  $new->set_password($newpass);
+  }
 }
 
 if ( ! $error ) {
@@ -102,10 +107,14 @@ if ( ! $error ) {
       map { $_ => $cgi->param("router_$_") }
       qw( routernum routername blocknum )
     });
-    if (length($router->routername == 0)) {
+    if (length($router->routername) == 0) {
       #sensible default
       $router->set('routername', $new->label);
     }
+    if (length($router->blocknum) == 0) {
+      #unset it
+      $router->set('blocknum', 0);
+    }
     push @child_objects, $router;
   }