Diff for /loncom/interface/lonuserutils.pm between versions 1.200 and 1.208

version 1.200, 2019/05/11 21:34:01 version 1.208, 2021/08/23 20:10:40
Line 656  sub passwd_validation_js { Line 656  sub passwd_validation_js {
     my %passwdconf = &Apache::lonnet::get_passwdconf($domain);      my %passwdconf = &Apache::lonnet::get_passwdconf($domain);
     my ($min,$max,@chars,$numrules,$intargjs,%alert);      my ($min,$max,@chars,$numrules,$intargjs,%alert);
     $numrules = 0;      $numrules = 0;
       $min = $Apache::lonnet::passwdmin;
     if (ref($passwdconf{'chars'}) eq 'ARRAY') {      if (ref($passwdconf{'chars'}) eq 'ARRAY') {
         if ($passwdconf{'min'} =~ /^\d+$/) {          if ($passwdconf{'min'} =~ /^\d+$/) {
             $min = $passwdconf{'min'};              if ($passwdconf{'min'} > $min) {
             $numrules ++;                  $min = $passwdconf{'min'};
               }
         }          }
         if ($passwdconf{'max'} =~ /^\d+$/) {          if ($passwdconf{'max'} =~ /^\d+$/) {
             $max = $passwdconf{'max'};              $max = $passwdconf{'max'};
Line 669  sub passwd_validation_js { Line 671  sub passwd_validation_js {
         if (@chars) {          if (@chars) {
             $numrules ++;              $numrules ++;
         }          }
     } else {      }
         $min = 7;      if ($min > 0) {
         $numrules ++;          $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';          my $alertmsg = &mt('Initial password did not satisfy requirement(s):').'\n\n';
         if ($min) {          if ($min) {
             $alert{'min'} = &mt('minimum [quant,_1,character]',$min).'\n';              $alert{'min'} = &mt('minimum [quant,_1,character]',$min).'\n';
Line 1707  sub my_custom_roles { Line 1709  sub my_custom_roles {
     my %rolehash=&Apache::lonnet::dump('roles',$udom,$uname);      my %rolehash=&Apache::lonnet::dump('roles',$udom,$uname);
     foreach my $key (keys(%rolehash)) {      foreach my $key (keys(%rolehash)) {
         if ($key=~/^rolesdef\_(\w+)$/) {          if ($key=~/^rolesdef\_(\w+)$/) {
               my $role = $1;
             if ($crstype eq 'Community') {              if ($crstype eq 'Community') {
                 next if ($rolehash{$key} =~ /bre\&S/);                   next if ($rolehash{$key} =~ /bre\&S/); 
             }              }
             $returnhash{$1}=$1;              $returnhash{$role}=$role;
         }          }
     }      }
     return %returnhash;      return %returnhash;
Line 2433  sub build_user_record { Line 2436  sub build_user_record {
   
 sub courses_selector {  sub courses_selector {
     my ($cdom,$formname) = @_;      my ($cdom,$formname) = @_;
     my %coursecodes = ();  
     my %codes = ();      my %codes = ();
     my @codetitles = ();      my @codetitles = ();
     my %cat_titles = ();      my %cat_titles = ();
Line 2446  sub courses_selector { Line 2448  sub courses_selector {
     my $jscript = '';      my $jscript = '';
   
     my $totcodes = 0;      my $totcodes = 0;
     $totcodes =      my $instcats = &Apache::lonnet::get_dom_instcats($cdom);
         &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,      if (ref($instcats) eq 'HASH') {
                                                       $cdom,$totcodes);          if ((ref($instcats->{'codetitles'}) eq 'ARRAY') && (ref($instcats->{'codes'}) eq 'HASH') &&
     if ($totcodes > 0) {              (ref($instcats->{'cat_titles'}) eq 'HASH') && (ref($instcats->{'cat_order'}) eq 'HASH')) {
         $format_reply =              %codes = %{$instcats->{'codes'}};
              &Apache::lonnet::auto_instcode_format($caller,$cdom,\%coursecodes,              @codetitles = @{$instcats->{'codetitles'}};
                                 \%codes,\@codetitles,\%cat_titles,\%cat_order);              %cat_titles = %{$instcats->{'cat_titles'}};
         if ($format_reply eq 'ok') {              %cat_order = %{$instcats->{'cat_order'}};
               $totcodes = scalar(keys(%codes));
             my $numtypes = @codetitles;              my $numtypes = @codetitles;
             &Apache::courseclassifier::build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles);              &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);              my ($scripttext,$longtitles) = &Apache::courseclassifier::javascript_definitions(\@codetitles,\%idlist,\%idlist_titles,\%idnums,\%cat_titles);
Line 3667  END Line 3670  END
         setSections(formname,'$crstype');          setSections(formname,'$crstype');
         if (seccheck == 'ok') {          if (seccheck == 'ok') {
             opener.document.$callingform.newsecs.value = formname.sections.value;              opener.document.$callingform.newsecs.value = formname.sections.value;
           } else {
               return;
         }          }
 END  END
     } else {      } else {
Line 4387  sub upfile_drop_add { Line 4392  sub upfile_drop_add {
         if ((defined($env{'form.intarg'})) && ($env{'form.intarg'})) {          if ((defined($env{'form.intarg'})) && ($env{'form.intarg'})) {
             $genpwd=$env{'form.intarg'};              $genpwd=$env{'form.intarg'};
             @genpwdfail =              @genpwdfail =
                 &Apache::loncommon::check_passwd_rules($domain,$genpwd);                   &Apache::loncommon::check_passwd_rules($domain,$genpwd);
         }          }
     } elsif ($env{'form.login'} eq 'loc') {      } elsif ($env{'form.login'} eq 'loc') {
         $amode='localauth';          $amode='localauth';
Line 5005  sub upfile_drop_add { Line 5010  sub upfile_drop_add {
                     my (%userres,%authres,%roleres,%idres);                      my (%userres,%authres,%roleres,%idres);
                     my $singlesec = '';                      my $singlesec = '';
                     if ($role eq 'st') {                      if ($role eq 'st') {
                           if (($context eq 'domain') && ($changeauth eq 'Yes') && (!$newuser)) {
                               if ((&Apache::lonnet::allowed('mau',$userdomain)) &&
                                   (&Apache::lonnet::homeserver($username,$userdomain) ne 'no_host')) {
                                   if ((($amode =~ /^krb4|krb5|internal$/) && $password ne '') ||
                                        ($amode eq 'localauth')) {
                                       $authresult =
                                           &Apache::lonnet::modifyuserauth($userdomain,$username,$amode,$password);
                                   }
                               }
                           }
                         my $sec;                          my $sec;
                         if (ref($userinfo{$i}{'sections'}) eq 'ARRAY') {                          if (ref($userinfo{$i}{'sections'}) eq 'ARRAY') {
                             if (@secs > 0) {                              if (@secs > 0) {
Line 5046  sub upfile_drop_add { Line 5061  sub upfile_drop_add {
                                     }                                      }
                                 }                                  }
                             }                              }
                             if (!$multiple) {                          }
                                 ($userresult,$authresult,$roleresult,$idresult) =                           if (!$multiple) {
                                     &modifyuserrole($context,$setting,                              ($userresult,$authresult,$roleresult,$idresult) = 
                                                     $changeauth,$cid,$userdomain,$username,                                   &modifyuserrole($context,$setting,
                                                     $id,$amode,$password,$fname,                                                  $changeauth,$cid,$userdomain,$username, 
                                                     $mname,$lname,$gen,$singlesec,                                                  $id,$amode,$password,$fname,
                                                     $env{'form.forceid'},$desiredhost,                                                  $mname,$lname,$gen,$singlesec,
                                                     $email,$role,$enddate,$startdate,                                                  $env{'form.forceid'},$desiredhost,
                                                     $checkid,$inststatus);                                                  $email,$role,$enddate,$startdate,
                             }                                                  $checkid,$inststatus);
                         }                          }
                     }                      }
                     if ($multiple) {                      if ($multiple) {
Line 5175  sub passwdrule_alerts { Line 5190  sub passwdrule_alerts {
             my %passwdconf = &Apache::lonnet::get_passwdconf($domain);              my %passwdconf = &Apache::lonnet::get_passwdconf($domain);
             $warning = '<b>'.&mt('Password requirement(s) unmet for one or more users:').'</b><ul>';              $warning = '<b>'.&mt('Password requirement(s) unmet for one or more users:').'</b><ul>';
             if ($showrules{'min'}) {              if ($showrules{'min'}) {
                 $warning .= '<li>'.&mt('minimum [quant,_1,character]',$passwdconf{'min'}).'</li>';                  my $min = $passwdconf{'min'};
                   if ($min eq '') {
                       $min = $Apache::lonnet::passwdmin;
                   }
                   $warning .= '<li>'.&mt('minimum [quant,_1,character]',$min).'</li>';
             }              }
             if ($showrules{'max'}) {              if ($showrules{'max'}) {
                 $warning .= '<li>'.&mt('maximum [quant,_1,character]',$passwdconf{'max'}).'</li>';                  $warning .= '<li>'.&mt('maximum [quant,_1,character]',$passwdconf{'max'}).'</li>';

Removed from v.1.200  
changed lines
  Added in v.1.208


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>