Diff for /loncom/interface/domainprefs.pm between versions 1.160.6.102.2.2 and 1.160.6.102.2.3

version 1.160.6.102.2.2, 2020/02/04 18:51:20 version 1.160.6.102.2.3, 2020/02/12 23:06:16
Line 742  sub print_config_box { Line 742  sub print_config_box {
     if ($numheaders > 1) {      if ($numheaders > 1) {
         my $colspan = '';          my $colspan = '';
         my $rightcolspan = '';          my $rightcolspan = '';
           my $leftnobr = '';
         if (($action eq 'rolecolors') || ($action eq 'defaults') ||          if (($action eq 'rolecolors') || ($action eq 'defaults') ||
             ($action eq 'directorysrch') ||              ($action eq 'directorysrch') ||
             (($action eq 'login') && ($numheaders < 4))) {              (($action eq 'login') && ($numheaders < 4))) {
Line 750  sub print_config_box { Line 751  sub print_config_box {
         if ($action eq 'usersessions') {          if ($action eq 'usersessions') {
             $rightcolspan = ' colspan="3"';               $rightcolspan = ' colspan="3"'; 
         }          }
           if ($action eq 'passwords') {
               $leftnobr = ' LC_nobreak';
           }
         $output .= '          $output .= '
           <tr>            <tr>
            <td>             <td>
             <table class="LC_nested">              <table class="LC_nested">
              <tr class="LC_info_row">               <tr class="LC_info_row">
               <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[0]->{'col1'}).'</td>                <td class="LC_left_item'.$leftnobr.'"'.$colspan.'>'.&mt($item->{'header'}->[0]->{'col1'}).'</td>
               <td class="LC_right_item"'.$rightcolspan.'>'.&mt($item->{'header'}->[0]->{'col2'}).'</td>                <td class="LC_right_item"'.$rightcolspan.'>'.&mt($item->{'header'}->[0]->{'col2'}).'</td>
              </tr>';               </tr>';
         $rowtotal ++;          $rowtotal ++;
Line 814  sub print_config_box { Line 818  sub print_config_box {
            <td>             <td>
             <table class="LC_nested">              <table class="LC_nested">
              <tr class="LC_info_row">               <tr class="LC_info_row">
               <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>                <td class="LC_left_item'.$leftnobr.'"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
               <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>                <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>
              </tr>'."\n";               </tr>'."\n";
             if ($action eq 'coursecategories') {              if ($action eq 'coursecategories') {
Line 4759  sub print_passwords { Line 4763  sub print_passwords {
                 $datatable .= '<span class="LC_nobreak"><label>'.                  $datatable .= '<span class="LC_nobreak"><label>'.
                               '<input type="checkbox" name="passwords_case_sensitive" value="'.                                '<input type="checkbox" name="passwords_case_sensitive" value="'.
                               $item.'"'.$checkedcase.' />'.$usertypes->{$item}.'</label>'.                                $item.'"'.$checkedcase.' />'.$usertypes->{$item}.'</label>'.
                               '<span>&nbsp;&nbsp; ';                                '</span>&nbsp;&nbsp; ';
             }              }
         }          }
         my $checkedcase;          my $checkedcase;
Line 4863  sub print_passwords { Line 4867  sub print_passwords {
                       &mt('(If you use the same account ...  reset a password from this page.)').'</span><br /><br />'.                        &mt('(If you use the same account ...  reset a password from this page.)').'</span><br /><br />'.
                       &mt('Include custom text:');                        &mt('Include custom text:');
         if ($customurl) {          if ($customurl) {
             my $link =  &Apache::loncommon::modal_link($customurl,&mt('Custom text file'),600,500,              my $link =  &Apache::loncommon::modal_link($customurl,&mt('custom text'),600,500,
                                                        undef,undef,undef,undef,'background-color:#ffffff');                                                         undef,undef,undef,undef,'background-color:#ffffff');
             $datatable .= '<span class="LC_nobreak">&nbsp;'.$link.              $datatable .= '<span class="LC_nobreak">&nbsp;'.$link.
                           '<label><input type="checkbox" name="passwords_custom_del"'.                            '<label><input type="checkbox" name="passwords_custom_del"'.
Line 5079  sub print_passwords { Line 5083  sub print_passwords {
                     $datatable .= '<span class="LC_nobreak"><label>'.                      $datatable .= '<span class="LC_nobreak"><label>'.
                                   '<input type="checkbox" name="passwords_crsowner_'.$item.'" value="'.                                    '<input type="checkbox" name="passwords_crsowner_'.$item.'" value="'.
                                   $type.'"'.$checked.' />'.$usertypes->{$type}.'</label>'.                                    $type.'"'.$checked.' />'.$usertypes->{$type}.'</label>'.
                                   '<span>&nbsp;&nbsp; ';                                    '</span>&nbsp;&nbsp; ';
                 }                  }
             }              }
             my $checked;              my $checked;
Line 7830  function warnIntPass(field) { Line 7834  function warnIntPass(field) {
                             alert('$intalert{passnum}');                              alert('$intalert{passnum}');
                         }                          }
                     }                      }
                       field.value = '';
                 }                  }
                 field.value = '';  
             }              }
         }          }
     }      }
Line 12174  sub modify_passwords { Line 12178  sub modify_passwords {
                 if ($staticdefaults{$rule} ne $newvalues{$rule}) {                  if ($staticdefaults{$rule} ne $newvalues{$rule}) {
                     $changes{'rules'} = 1;                      $changes{'rules'} = 1;
                 }                  }
               } else {
                   $changes{'rules'} = 1;
             }              }
         } elsif (exists($current{$rule})) {          } elsif (exists($current{$rule})) {
             $changes{'rules'} = 1;              $changes{'rules'} = 1;
Line 12252  sub modify_passwords { Line 12258  sub modify_passwords {
                             $resulttext .= '<li>'.&mt('CAPTCHA validation set to use: original CAPTCHA').'</li>';                              $resulttext .= '<li>'.&mt('CAPTCHA validation set to use: original CAPTCHA').'</li>';
                         } elsif ($confighash{'passwords'}{'captcha'} eq 'recaptcha') {                          } elsif ($confighash{'passwords'}{'captcha'} eq 'recaptcha') {
                             $resulttext .= '<li>'.&mt('CAPTCHA validation set to use: reCAPTCHA').' '.                              $resulttext .= '<li>'.&mt('CAPTCHA validation set to use: reCAPTCHA').' '.
                                            &mt('version: [_1]',$confighash{'passwords'}{'recaptchaversion'}).'<br />'.                                             &mt('version: [_1]',$confighash{'passwords'}{'recaptchaversion'}).'<br />';
                                            &mt('Public key: [_1]',$confighash{'passwords'}{'recaptchapub'}).'</br>'.                              if (ref($confighash{'passwords'}{'recaptchakeys'}) eq 'HASH') {
                                            &mt('Private key: [_1]',$confighash{'passwords'}{'recaptchapriv'}).'</li>';                                  $resulttext .= &mt('Public key: [_1]',$confighash{'passwords'}{'recaptchakeys'}{'public'}).'</br>'.
                                                  &mt('Private key: [_1]',$confighash{'passwords'}{'recaptchakeys'}{'private'}).'</li>';
                               }
                         } else {                          } else {
                             $resulttext .= '<li>'.&mt('No CAPTCHA validation').'</li>';                              $resulttext .= '<li>'.&mt('No CAPTCHA validation').'</li>';
                         }                          }
Line 12333  sub modify_passwords { Line 12341  sub modify_passwords {
                         }                          }
                         if ($confighash{'passwords'}{'resetcustom'}) {                          if ($confighash{'passwords'}{'resetcustom'}) {
                             my $customlink = &Apache::loncommon::modal_link($confighash{'passwords'}{'resetcustom'},                              my $customlink = &Apache::loncommon::modal_link($confighash{'passwords'}{'resetcustom'},
                                                                             $titles{custom},600,500);                                                                              &mt('custom text'),600,500,undef,undef,
                             $resulttext .= '<li>'.&mt('Preamble to "Forgot Password" form includes [_1]',$customlink).'</li>';                                                                              undef,undef,'background-color:#ffffff');
                               $resulttext .= '<li>'.&mt('Preamble to "Forgot Password" form includes: [_1]',$customlink).'</li>';
                         } else {                          } else {
                             $resulttext .= '<li>'.&mt('No custom text included in preamble to "Forgot Password" form').'</li>';                              $resulttext .= '<li>'.&mt('No custom text included in preamble to "Forgot Password" form').'</li>';
                         }                          }
Line 12380  sub modify_passwords { Line 12389  sub modify_passwords {
                                 $resulttext .= '<li>'.&mt('[_1] set to [_2]',$titles{$rule},$confighash{'passwords'}{$rule}).'</li>';                                  $resulttext .= '<li>'.&mt('[_1] set to [_2]',$titles{$rule},$confighash{'passwords'}{$rule}).'</li>';
                             }                              }
                         }                          }
                           if (ref($confighash{'passwords'}{'chars'}) eq 'ARRAY') {
                               if (@{$confighash{'passwords'}{'chars'}} > 0) {
                                   my %rulenames = &Apache::lonlocal::texthash(
                                                        uc => 'At least one upper case letter',
                                                        lc => 'At least one lower case letter',
                                                        num => 'At least one number',
                                                        spec => 'At least one non-alphanumeric',
                                                      );
                                   my $needed = '<ul><li>'.
                                                join('</li><li>',map {$rulenames{$_} } @{$confighash{'passwords'}{'chars'}}).
                                                '</li></ul>';
                                   $resulttext .= '<li>'.&mt('[_1] set to: [_2]',$titles{'chars'},$needed).'</li>';
                               } else {
                                   $resulttext .= '<li>'.&mt('[_1] set to none',$titles{'chars'}).'</li>';
                               }
                           } else {
                               $resulttext .= '<li>'.&mt('[_1] set to none',$titles{'chars'}).'</li>';
                           }
                     } elsif ($key eq 'crsownerchg') {                      } elsif ($key eq 'crsownerchg') {
                         if (ref($confighash{'passwords'}{'crsownerchg'}) eq 'HASH') {                          if (ref($confighash{'passwords'}{'crsownerchg'}) eq 'HASH') {
                             if ((@{$confighash{'passwords'}{'crsownerchg'}{'by'}} == 0) ||                              if ((@{$confighash{'passwords'}{'crsownerchg'}{'by'}} == 0) ||
Line 13520  sub modify_selfcreation { Line 13547  sub modify_selfcreation {
 }  }
   
 sub process_captcha {  sub process_captcha {
     my ($container,$changes,$newsettings,$current) = @_;      my ($container,$changes,$newsettings,$currsettings) = @_;
     return unless ((ref($changes) eq 'HASH') && (ref($newsettings) eq 'HASH') || (ref($current) eq 'HASH'));      return unless ((ref($changes) eq 'HASH') && (ref($newsettings) eq 'HASH'));
     $newsettings->{'captcha'} = $env{'form.'.$container.'_captcha'};      $newsettings->{'captcha'} = $env{'form.'.$container.'_captcha'};
     unless ($newsettings->{'captcha'} eq 'recaptcha' || $newsettings->{'captcha'} eq 'notused') {      unless ($newsettings->{'captcha'} eq 'recaptcha' || $newsettings->{'captcha'} eq 'notused') {
         $newsettings->{'captcha'} = 'original';          $newsettings->{'captcha'} = 'original';
     }      }
     if ($current->{'captcha'} ne $newsettings->{'captcha'}) {      my %current;
       if (ref($currsettings) eq 'HASH') {
           %current = %{$currsettings};
       }
       if ($current{'captcha'} ne $newsettings->{'captcha'}) {
         if ($container eq 'cancreate') {          if ($container eq 'cancreate') {
             if (ref($changes->{'cancreate'}) eq 'ARRAY') {              if (ref($changes->{'cancreate'}) eq 'ARRAY') {
                 push(@{$changes->{'cancreate'}},'captcha');                  push(@{$changes->{'cancreate'}},'captcha');
Line 13556  sub process_captcha { Line 13587  sub process_captcha {
         }          }
         $newsettings->{'recaptchaversion'} = $newversion;          $newsettings->{'recaptchaversion'} = $newversion;
     }      }
     if (ref($current->{'recaptchakeys'}) eq 'HASH') {      if (ref($current{'recaptchakeys'}) eq 'HASH') {
         $currpub = $current->{'recaptchakeys'}{'public'};          $currpub = $current{'recaptchakeys'}{'public'};
         $currpriv = $current->{'recaptchakeys'}{'private'};          $currpriv = $current{'recaptchakeys'}{'private'};
         unless ($newsettings->{'captcha'} eq 'recaptcha') {          unless ($newsettings->{'captcha'} eq 'recaptcha') {
             $newsettings->{'recaptchakeys'} = {              $newsettings->{'recaptchakeys'} = {
                                                  public  => '',                                                   public  => '',
Line 13566  sub process_captcha { Line 13597  sub process_captcha {
                                               }                                                }
         }          }
     }      }
     if ($current->{'captcha'} eq 'recaptcha') {      if ($current{'captcha'} eq 'recaptcha') {
         $currversion = $current->{'recaptchaversion'};          $currversion = $current{'recaptchaversion'};
         if ($currversion ne '2') {          if ($currversion ne '2') {
             $currversion = 1;              $currversion = 1;
         }          }

Removed from v.1.160.6.102.2.2  
changed lines
  Added in v.1.160.6.102.2.3


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