[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface domainprefs.pm

raeburn raeburn at source.lon-capa.org
Sun Feb 9 00:18:22 EST 2020


raeburn		Sun Feb  9 05:18:22 2020 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - For 2.11
    Backport 1.369, 1.370.
  
  
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.103 loncom/interface/domainprefs.pm:1.160.6.104
--- loncom/interface/domainprefs.pm:1.160.6.103	Tue Feb  4 03:44:19 2020
+++ loncom/interface/domainprefs.pm	Sun Feb  9 05:18:20 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.160.6.103 2020/02/04 03:44:19 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.104 2020/02/09 05:18:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -718,6 +718,7 @@
     if ($numheaders > 1) {
         my $colspan = '';
         my $rightcolspan = '';
+        my $leftnobr = '';  
         if (($action eq 'rolecolors') || ($action eq 'defaults') ||
             ($action eq 'directorysrch') ||
             (($action eq 'login') && ($numheaders < 4))) {
@@ -726,12 +727,15 @@
         if ($action eq 'usersessions') {
             $rightcolspan = ' colspan="3"'; 
         }
+        if ($action eq 'passwords') {
+            $leftnobr = ' LC_nobreak';
+        }
         $output .= '
           <tr>
            <td>
             <table class="LC_nested">
              <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>
              </tr>';
         $rowtotal ++;
@@ -790,7 +794,7 @@
            <td>
             <table class="LC_nested">
              <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>
              </tr>'."\n";
             if ($action eq 'coursecategories') {
@@ -4299,7 +4303,7 @@
                 $datatable .= '<span class="LC_nobreak"><label>'.
                               '<input type="checkbox" name="passwords_case_sensitive" value="'.
                               $item.'"'.$checkedcase.' />'.$usertypes->{$item}.'</label>'.
-                              '<span>   ';
+                              '</span>   ';
             }
         }
         my $checkedcase;
@@ -4403,7 +4407,7 @@
                       &mt('(If you use the same account ...  reset a password from this page.)').'</span><br /><br />'.
                       &mt('Include custom text:');
         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');
             $datatable .= '<span class="LC_nobreak"> '.$link.
                           '<label><input type="checkbox" name="passwords_custom_del"'.
@@ -4619,7 +4623,7 @@
                     $datatable .= '<span class="LC_nobreak"><label>'.
                                   '<input type="checkbox" name="passwords_crsowner_'.$item.'" value="'.
                                   $type.'"'.$checked.' />'.$usertypes->{$type}.'</label>'.
-                                  '<span>   ';
+                                  '</span>   ';
                 }
             }
             my $checked;
@@ -7370,8 +7374,8 @@
                             alert('$intalert{passnum}');
                         }
                     }
+                    field.value = '';
                 }
-                field.value = '';
             }
         }
     }
@@ -11130,6 +11134,8 @@
                 if ($staticdefaults{$rule} ne $newvalues{$rule}) {
                     $changes{'rules'} = 1;
                 }
+            } else {
+                $changes{'rules'} = 1;
             }
         } elsif (exists($current{$rule})) {
             $changes{'rules'} = 1;
@@ -11208,9 +11214,11 @@
                             $resulttext .= '<li>'.&mt('CAPTCHA validation set to use: original CAPTCHA').'</li>';
                         } elsif ($confighash{'passwords'}{'captcha'} eq 'recaptcha') {
                             $resulttext .= '<li>'.&mt('CAPTCHA validation set to use: reCAPTCHA').' '.
-                                           &mt('version: [_1]',$confighash{'passwords'}{'recaptchaversion'}).'<br />'.
-                                           &mt('Public key: [_1]',$confighash{'passwords'}{'recaptchapub'}).'</br>'.
-                                           &mt('Private key: [_1]',$confighash{'passwords'}{'recaptchapriv'}).'</li>';
+                                           &mt('version: [_1]',$confighash{'passwords'}{'recaptchaversion'}).'<br />';
+                            if (ref($confighash{'passwords'}{'recaptchakeys'}) eq 'HASH') {
+                                $resulttext .= &mt('Public key: [_1]',$confighash{'passwords'}{'recaptchakeys'}{'public'}).'</br>'.
+                                               &mt('Private key: [_1]',$confighash{'passwords'}{'recaptchakeys'}{'private'}).'</li>';
+                            }
                         } else {
                             $resulttext .= '<li>'.&mt('No CAPTCHA validation').'</li>';
                         }
@@ -11289,8 +11297,9 @@
                         }
                         if ($confighash{'passwords'}{'resetcustom'}) {
                             my $customlink = &Apache::loncommon::modal_link($confighash{'passwords'}{'resetcustom'},
-                                                                            $titles{custom},600,500);
-                            $resulttext .= '<li>'.&mt('Preamble to "Forgot Password" form includes [_1]',$customlink).'</li>';
+                                                                            &mt('custom text'),600,500,undef,undef,
+                                                                            undef,undef,'background-color:#ffffff');
+                            $resulttext .= '<li>'.&mt('Preamble to "Forgot Password" form includes: [_1]',$customlink).'</li>';
                         } else {
                             $resulttext .= '<li>'.&mt('No custom text included in preamble to "Forgot Password" form').'</li>';
                         }
@@ -11336,6 +11345,24 @@
                                 $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') {
                         if (ref($confighash{'passwords'}{'crsownerchg'}) eq 'HASH') {
                             if ((@{$confighash{'passwords'}{'crsownerchg'}{'by'}} == 0) ||
@@ -12476,13 +12503,17 @@
 }
 
 sub process_captcha {
-    my ($container,$changes,$newsettings,$current) = @_;
-    return unless ((ref($changes) eq 'HASH') && (ref($newsettings) eq 'HASH') || (ref($current) eq 'HASH'));
+    my ($container,$changes,$newsettings,$currsettings) = @_;
+    return unless ((ref($changes) eq 'HASH') && (ref($newsettings) eq 'HASH'));
     $newsettings->{'captcha'} = $env{'form.'.$container.'_captcha'};
     unless ($newsettings->{'captcha'} eq 'recaptcha' || $newsettings->{'captcha'} eq 'notused') {
         $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 (ref($changes->{'cancreate'}) eq 'ARRAY') {
                 push(@{$changes->{'cancreate'}},'captcha');
@@ -12512,9 +12543,9 @@
         }
         $newsettings->{'recaptchaversion'} = $newversion;
     }
-    if (ref($current->{'recaptchakeys'}) eq 'HASH') {
-        $currpub = $current->{'recaptchakeys'}{'public'};
-        $currpriv = $current->{'recaptchakeys'}{'private'};
+    if (ref($current{'recaptchakeys'}) eq 'HASH') {
+        $currpub = $current{'recaptchakeys'}{'public'};
+        $currpriv = $current{'recaptchakeys'}{'private'};
         unless ($newsettings->{'captcha'} eq 'recaptcha') {
             $newsettings->{'recaptchakeys'} = {
                                                  public  => '',
@@ -12522,8 +12553,8 @@
                                               }
         }
     }
-    if ($current->{'captcha'} eq 'recaptcha') {
-        $currversion = $current->{'recaptchaversion'};
+    if ($current{'captcha'} eq 'recaptcha') {
+        $currversion = $current{'recaptchaversion'};
         if ($currversion ne '2') {
             $currversion = 1;
         }


More information about the LON-CAPA-cvs mailing list