--- loncom/interface/lonuserutils.pm 2019/05/11 21:34:01 1.200 +++ loncom/interface/lonuserutils.pm 2019/08/26 00:15:57 1.203 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.200 2019/05/11 21:34:01 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.203 2019/08/26 00:15:57 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'; @@ -2433,7 +2435,6 @@ sub build_user_record { sub courses_selector { my ($cdom,$formname) = @_; - my %coursecodes = (); my %codes = (); my @codetitles = (); my %cat_titles = (); @@ -2446,14 +2447,15 @@ sub courses_selector { my $jscript = ''; my $totcodes = 0; - $totcodes = - &Apache::courseclassifier::retrieve_instcodes(\%coursecodes, - $cdom,$totcodes); - if ($totcodes > 0) { - $format_reply = - &Apache::lonnet::auto_instcode_format($caller,$cdom,\%coursecodes, - \%codes,\@codetitles,\%cat_titles,\%cat_order); - if ($format_reply eq 'ok') { + my $instcats = &Apache::lonnet::get_dom_instcats($cdom); + if (ref($instcats) eq 'HASH') { + if ((ref($instcats->{'codetitles'}) eq 'ARRAY') && (ref($instcats->{'codes'}) eq 'HASH') && + (ref($instcats->{'cat_titles'}) eq 'HASH') && (ref($instcats->{'cat_order'}) eq 'HASH')) { + %codes = %{$instcats->{'codes'}}; + @codetitles = @{$instcats->{'codetitles'}}; + %cat_titles = %{$instcats->{'cat_titles'}}; + %cat_order = %{$instcats->{'cat_order'}}; + $totcodes = scalar(keys(%codes)); my $numtypes = @codetitles; &Apache::courseclassifier::build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles); my ($scripttext,$longtitles) = &Apache::courseclassifier::javascript_definitions(\@codetitles,\%idlist,\%idlist_titles,\%idnums,\%cat_titles); @@ -4387,7 +4389,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';