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

raeburn raeburn at source.lon-capa.org
Tue Jan 14 08:38:27 EST 2025


raeburn		Tue Jan 14 13:38:27 2025 EDT

  Modified files:              (Branch: version_2_12_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - For 2.12 Domain configuraion for Passwords (Internal authentication).
    Rule for expiration not included in 2.12.0
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.447.2.4 loncom/interface/domainprefs.pm:1.447.2.5
--- loncom/interface/domainprefs.pm:1.447.2.4	Tue Jan 14 13:20:29 2025
+++ loncom/interface/domainprefs.pm	Tue Jan 14 13:38:26 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.447.2.4 2025/01/14 13:20:29 raeburn Exp $
+# $Id: domainprefs.pm,v 1.447.2.5 2025/01/14 13:38:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7937,7 +7937,6 @@
         min            => 'Minimum password length',
         max            => 'Maximum password length',
         chars          => 'Required characters',
-        expire         => 'Password expiration (days)',
         numsaved       => 'Number of previous passwords to save and disallow reuse',
     );
     if ($position eq 'top') {
@@ -8264,7 +8263,7 @@
 
 sub password_rules {
     my ($prefix,$itemcountref,$settings) = @_;
-    my ($min,$max,%chars,$expire,$numsaved,$numinrow);
+    my ($min,$max,%chars,$numsaved,$numinrow);
     my %titles;
     if ($prefix eq 'passwords') {
         %titles = &Apache::lonlocal::texthash (
@@ -8296,9 +8295,6 @@
             map { $chars{$_} = 1; } (@{$settings->{chars}});
         }
         if ($prefix eq 'passwords') {
-            if ($settings->{expire}) {
-                $expire = $settings->{expire};
-            }
             if ($settings->{numsaved}) {
                 $numsaved = $settings->{numsaved};
             }
@@ -8360,17 +8356,8 @@
     $datatable .='</table></td></tr>';
     $itemcount ++;
     if ($prefix eq 'passwords') {
-        $titles{'expire'} = &mt('Password expiration (days)');
         $titles{'numsaved'} = &mt('Number of previous passwords to save and disallow reuse');
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
-        $datatable .= '<tr'.$css_class.'><td>'.$titles{'expire'}.'</td>'.
-                      '<td class="LC_left_item"><span class="LC_nobreak">'.
-                      '<input type="text" name="'.$prefix.'_expire" value="'.$expire.'" size="4" '.
-                      'onblur="javascript:warnInt'.$prefix.'(this);" />'.
-                      '<span class="LC_fontsize_small"> '.&mt('(Leave blank for no expiration)').'</span>'.
-                      '</span></td></tr>';
-        $itemcount ++;
-        $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'numsaved'}.'</td>'.
                       '<td class="LC_left_item"><span class="LC_nobreak">'.
                       '<input type="text" name="'.$prefix.'_numsaved" value="'.$numsaved.'" size="3" '.
@@ -11752,29 +11739,15 @@
             field.value = '';
         }
         if (field.value != '') {
-            if (field.name == '${prefix}_expire') {
-                var regexpposnum=/^\\d+(|\\.\\d*)\$/; 
-                if (!regexpposnum.test(field.value)) {
-                    alert('$intalert{passexp}');
-                    field.value = '';
+            if (!regexdigit.test(field.value)) {
+                if (field.name == '${prefix}_max') {
+                    alert('$intalert{passmax}');
                 } else {
-                    var expval = parseFloat(field.value);
-                    if (expval == 0) {
-                        alert('$intalert{passexp}');
-                        field.value = '';
+                    if (field.name == '${prefix}_numsaved') {
+                        alert('$intalert{passnum}');
                     }
                 }
-            } else {
-                if (!regexdigit.test(field.value)) {
-                    if (field.name == '${prefix}_max') {
-                        alert('$intalert{passmax}');
-                    } else {
-                        if (field.name == '${prefix}_numsaved') {
-                            alert('$intalert{passnum}');
-                        }
-                    }
-                    field.value = '';
-                }
+                field.value = '';
             }
         }
     }
@@ -18090,7 +18063,6 @@
         min            => 'Minimum password length',
         max            => 'Maximum password length',
         chars          => 'Required characters',
-        expire         => 'Password expiration (days)',
         numsaved       => 'Number of previous passwords to save',
         reset          => 'Resetting Forgotten Password',
         intauth        => 'Encryption of Stored Passwords (Internal Auth)',
@@ -18474,7 +18446,7 @@
                             $resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$titles{$key.'_'.$item},$value).'</li>';
                         }
                     } elsif ($key eq 'rules') {
-                        foreach my $rule ('min','max','expire','numsaved') {
+                        foreach my $rule ('min','max','numsaved') {
                             if ($confighash{'passwords'}{$rule} eq '') {
                                 if ($rule eq 'min') {
                                     $resulttext .= '<li>'.&mt('[_1] not set.',$titles{$rule});
@@ -18569,7 +18541,7 @@
                    (ref($changes) eq 'HASH'));
     my (@rules,%staticdefaults);
     if ($prefix eq 'passwords') {
-        @rules = ('min','max','expire','numsaved');
+        @rules = ('min','max','numsaved');
     } elsif (($prefix eq 'ltisecrets') || ($prefix eq 'toolsecrets')) {
         @rules = ('min','max');
     }
@@ -18577,12 +18549,7 @@
     foreach my $rule (@rules) {
         $env{'form.'.$prefix.'_'.$rule} =~ s/^\s+|\s+$//g;
         my $ruleok;
-        if ($rule eq 'expire') {
-            if (($env{'form.'.$prefix.'_'.$rule} =~ /^\d+(|\.\d*)$/) &&
-                ($env{'form.'.$prefix.'_'.$rule} ne '0')) {
-                $ruleok = 1;
-            }
-        } elsif ($rule eq 'min') {
+        if ($rule eq 'min') {
             if ($env{'form.'.$prefix.'_'.$rule} =~ /^\d+$/) {
                 if ($env{'form.'.$prefix.'_'.$rule} >= $staticdefaults{$rule}) {
                     $ruleok = 1;




More information about the LON-CAPA-cvs mailing list