--- loncom/interface/lonpreferences.pm 2019/04/30 12:56:23 1.232 +++ loncom/interface/lonpreferences.pm 2019/08/21 22:41:13 1.235 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.232 2019/04/30 12:56:23 raeburn Exp $ +# $Id: lonpreferences.pm,v 1.235 2019/08/21 22:41:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -363,7 +363,7 @@ $options.' &Apache::lonhtmlcommon::row_closure(1). &Apache::lonhtmlcommon::end_pick_box().' '); - if ($roles_check_list) { + if ($roles_check_list) { $r->print('

'.&mt('Freeze Roles').'

'.&mt('The table below can be used to [_1]freeze[_2] '.$lc_role.'s in the Hotlist.','','').'
'. @@ -1408,7 +1408,7 @@ sub jscript_send { |; } if ((ref($extrafields) eq 'HASH') && ($extrafields->{'email'})) { - $output .= qq| + $output .= qq| this.document.pserver.elements.email.value = this.document.client.elements.email.value; |; @@ -1444,7 +1444,7 @@ sub client_form { .&Apache::lonhtmlcommon::row_closure(); } if ((ref($extrafields) eq 'HASH') && ($extrafields->{'username'})) { - $output .= &Apache::lonhtmlcommon::row_title( + $output .= &Apache::lonhtmlcommon::row_title( '') .'' .&Apache::lonhtmlcommon::row_closure() @@ -1636,69 +1636,8 @@ ENDERROR return 1; } } else { - my %passwdconf = &Apache::lonnet::get_passwdconf($domain); - my ($min,$max,@chars,@brokerule); - if (ref($passwdconf{'chars'}) eq 'ARRAY') { - if ($passwdconf{'min'} =~ /^\d+$/) { - $min = $passwdconf{'min'}; - } - if ($passwdconf{'max'} =~ /^\d+$/) { - $max = $passwdconf{'max'}; - } - @chars = @{$passwdconf{'chars'}}; - } else { - $min = 7; - } - if (($min) && (length($newpass1) < $min)) { - push(@brokerule,'min'); - } - if (($max) && (length($newpass1) > $max)) { - push(@brokerule,'max'); - } - if (@chars) { - my %rules; - map { $rules{$_} = 1; } @chars; - if ($rules{'uc'}) { - unless ($newpass1 =~ /[A-Z]/) { - push(@brokerule,'uc'); - } - } - if ($rules{'lc'}) { - unless ($newpass1 =~ /a-z/) { - push(@brokerule,'lc'); - } - } - if ($rules{'num'}) { - unless ($newpass1 =~ /\d/) { - push(@brokerule,'num'); - } - } - if ($rules{'spec'}) { - unless ($newpass1 =~ /[!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/) { - push(@brokerule,'spec'); - } - } - } - if (@brokerule) { - 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', - ); - $rulenames{'uc'} .= ': ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $rulenames{'lc'} .= ': abcdefghijklmnopqrstuvwxyz'; - $rulenames{'num'} .= ': 0123456789'; - $rulenames{'spec'} .= ': !"\#$%&\'()*+,-./:;<=>?@[\]^_\`{|}~'; - $rulenames{'min'} = &mt('Minimum password length: [_1]',$min); - $rulenames{'max'} = &mt('Maximum password length: [_1]',$max); - my $warning = &mt('Password did not satisfy the following:').'

'; + my $warning = &Apache::loncommon::check_passwd_rules($domain,$newpass1); + if ($warning) { &passwordchanger($r,''. $warning. &mt('Please try again.').'', @@ -2367,7 +2306,7 @@ sub handler { } else { $brlink ='/adm/preferences'; $brtxt = 'Set User Preferences'; - $brhelp = 'Prefs_About_Me,Prefs_Language,Prefs_Screen_Name_Nickname,Change_Colors,Change_Password,Prefs_Messages,Change_Discussion_Display'; + $brhelp = 'Prefs_About_Me,Prefs_Language,Prefs_Screen_Name_Nickname,Change_Colors,Change_Password,Prefs_Messages,Change_Discussion_Display'; } Apache::lonhtmlcommon::add_breadcrumb ({href => $brlink,