fix editing employee pw, RT#32456
[freeside.git] / httemplate / edit / process / access_user.html
index bbe4268..d589c62 100644 (file)
@@ -29,7 +29,7 @@ if ( FS::Conf->new->exists('disable_acl_changes') ) {
 sub precheck_callback {
   my $cgi = shift;
 
-  my $o = FS::access_user->new({username => $cgi->param('username')});
+  my $o = FS::access_user->new({username => scalar($cgi->param('username'))});
   if( $o->is_system_user and !$cgi->param('usernum') ) {
     $cgi->param('username','');
     return "username '".$o->username."' reserved for system account."
@@ -41,12 +41,11 @@ sub precheck_callback {
 sub post_new_object_callback {
   my( $cgi, $access_user ) = @_;
 
-  if ( length($cgi->param('_password')) ) {
-    my $password = scalar($cgi->param('_password'));
-    my $error = $access_user->is_password_allowed($password)
-             || $access_user->change_password($password);
-  }
+  return '' unless length($cgi->param('_password'));
 
+  my $password = scalar($cgi->param('_password'));
+  $access_user->is_password_allowed($password)
+    || $access_user->change_password_fields($password);
 }
 
 sub noerror_callback {