--- loncom/interface/lonuserutils.pm	2019/07/23 13:58:53	1.201
+++ loncom/interface/lonuserutils.pm	2020/02/10 17:12:54	1.205
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.201 2019/07/23 13:58:53 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.205 2020/02/10 17:12:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -656,10 +656,12 @@ sub passwd_validation_js {
     my %passwdconf = &Apache::lonnet::get_passwdconf($domain);
     my ($min,$max,@chars,$numrules,$intargjs,%alert);
     $numrules = 0;
+    $min = $Apache::lonnet::passwdmin;
     if (ref($passwdconf{'chars'}) eq 'ARRAY') {
         if ($passwdconf{'min'} =~ /^\d+$/) {
-            $min = $passwdconf{'min'};
-            $numrules ++;
+            if ($passwdconf{'min'} > $min) {
+                $min = $passwdconf{'min'};
+            }
         }
         if ($passwdconf{'max'} =~ /^\d+$/) {
             $max = $passwdconf{'max'};
@@ -669,11 +671,11 @@ sub passwd_validation_js {
         if (@chars) {
             $numrules ++;
         }
-    } else {
-        $min = 7;
+    }
+    if ($min > 0) {
         $numrules ++;
     }
-    if (($min ne '') || ($max ne '') || (@chars > 0)) {
+    if (($min > 0) || ($max ne '') || (@chars > 0)) {
         my $alertmsg = &mt('Initial password did not satisfy requirement(s):').'\n\n';
         if ($min) {
             $alert{'min'} = &mt('minimum [quant,_1,character]',$min).'\n';
@@ -3667,6 +3669,8 @@ END
         setSections(formname,'$crstype');
         if (seccheck == 'ok') {
             opener.document.$callingform.newsecs.value = formname.sections.value;
+        } else {
+            return;
         }
 END
     } else {
@@ -4387,7 +4391,7 @@ sub upfile_drop_add {
         if ((defined($env{'form.intarg'})) && ($env{'form.intarg'})) {
             $genpwd=$env{'form.intarg'};
             @genpwdfail =
-                &Apache::loncommon::check_passwd_rules($domain,$genpwd); 
+                &Apache::loncommon::check_passwd_rules($domain,$genpwd);
         }
     } elsif ($env{'form.login'} eq 'loc') {
         $amode='localauth';
@@ -5046,16 +5050,16 @@ sub upfile_drop_add {
                                     }
                                 }
                             }
-                            if (!$multiple) {
-                                ($userresult,$authresult,$roleresult,$idresult) = 
-                                    &modifyuserrole($context,$setting,
-                                                    $changeauth,$cid,$userdomain,$username, 
-                                                    $id,$amode,$password,$fname,
-                                                    $mname,$lname,$gen,$singlesec,
-                                                    $env{'form.forceid'},$desiredhost,
-                                                    $email,$role,$enddate,$startdate,
-                                                    $checkid,$inststatus);
-                            }
+                        }
+                        if (!$multiple) {
+                            ($userresult,$authresult,$roleresult,$idresult) = 
+                                &modifyuserrole($context,$setting,
+                                                $changeauth,$cid,$userdomain,$username, 
+                                                $id,$amode,$password,$fname,
+                                                $mname,$lname,$gen,$singlesec,
+                                                $env{'form.forceid'},$desiredhost,
+                                                $email,$role,$enddate,$startdate,
+                                                $checkid,$inststatus);
                         }
                     }
                     if ($multiple) {