version 1.346, 2019/01/27 14:39:48
|
version 1.356, 2019/04/26 20:22:18
|
Line 219 sub handler {
|
Line 219 sub handler {
|
'serverstatuses','requestcourses','helpsettings', |
'serverstatuses','requestcourses','helpsettings', |
'coursedefaults','usersessions','loadbalancing', |
'coursedefaults','usersessions','loadbalancing', |
'requestauthor','selfenrollment','inststatus', |
'requestauthor','selfenrollment','inststatus', |
'ltitools','ssl','trust','lti'],$dom); |
'ltitools','ssl','trust','lti','passwords'],$dom); |
my %encconfig = |
my %encconfig = |
&Apache::lonnet::get_dom('encconfig',['ltitools','lti'],$dom); |
&Apache::lonnet::get_dom('encconfig',['ltitools','lti'],$dom); |
if (ref($domconfig{'ltitools'}) eq 'HASH') { |
if (ref($domconfig{'ltitools'}) eq 'HASH') { |
Line 246 sub handler {
|
Line 246 sub handler {
|
} |
} |
} |
} |
} |
} |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
my @prefs_order = ('rolecolors','login','defaults','passwords','quotas','autoenroll', |
'autoupdate','autocreate','directorysrch','contacts', |
'autoupdate','autocreate','directorysrch','contacts', |
'usercreation','selfcreation','usermodification','scantron', |
'usercreation','selfcreation','usermodification','scantron', |
'requestcourses','requestauthor','coursecategories', |
'requestcourses','requestauthor','coursecategories', |
Line 291 sub handler {
|
Line 291 sub handler {
|
help => 'Domain_Configuration_LangTZAuth', |
help => 'Domain_Configuration_LangTZAuth', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value'}, |
col2 => 'Value'}, |
{col1 => 'Internal Authentication', |
|
col2 => 'Value'}, |
|
{col1 => 'Institutional user types', |
{col1 => 'Institutional user types', |
col2 => 'Name displayed'}], |
col2 => 'Name displayed'}], |
print => \&print_defaults, |
print => \&print_defaults, |
modify => \&modify_defaults, |
modify => \&modify_defaults, |
}, |
}, |
|
'passwords' => |
|
{ text => 'Passwords (Internal authentication)', |
|
help => 'Domain_Configuration_Passwords', |
|
header => [{col1 => 'Resetting Forgotten Password', |
|
col2 => 'Settings'}, |
|
{col1 => 'Encryption of Stored Passwords (Internal Auth)', |
|
col2 => 'Settings'}, |
|
{col1 => 'Rules for LON-CAPA Passwords', |
|
col2 => 'Settings'}, |
|
{col1 => 'Course Owner Changing Student Passwords', |
|
col2 => 'Settings'}], |
|
print => \&print_passwords, |
|
modify => \&modify_passwords, |
|
}, |
'quotas' => |
'quotas' => |
{ text => 'Blogs, personal web pages, webDAV/quotas, portfolios', |
{ text => 'Blogs, personal web pages, webDAV/quotas, portfolios', |
help => 'Domain_Configuration_Quotas', |
help => 'Domain_Configuration_Quotas', |
Line 759 sub process_changes {
|
Line 771 sub process_changes {
|
$output = &modify_trust($dom,$lastactref,%domconfig); |
$output = &modify_trust($dom,$lastactref,%domconfig); |
} elsif ($action eq 'lti') { |
} elsif ($action eq 'lti') { |
$output = &modify_lti($r,$dom,$action,$lastactref,%domconfig); |
$output = &modify_lti($r,$dom,$action,$lastactref,%domconfig); |
|
} elsif ($action eq 'passwords') { |
|
$output = &modify_passwords($r,$dom,$confname,$lastactref,%domconfig); |
} |
} |
return $output; |
return $output; |
} |
} |
Line 771 sub print_config_box {
|
Line 785 sub print_config_box {
|
$output = &coursecategories_javascript($settings); |
$output = &coursecategories_javascript($settings); |
} elsif ($action eq 'defaults') { |
} elsif ($action eq 'defaults') { |
$output = &defaults_javascript($settings); |
$output = &defaults_javascript($settings); |
|
} elsif ($action eq 'passwords') { |
|
$output = &passwords_javascript(); |
} elsif ($action eq 'helpsettings') { |
} elsif ($action eq 'helpsettings') { |
my (%privs,%levelscurrent); |
my (%privs,%levelscurrent); |
my %full=(); |
my %full=(); |
Line 830 sub print_config_box {
|
Line 846 sub print_config_box {
|
($action eq 'directorysrch') || ($action eq 'trust') || ($action eq 'helpsettings') || |
($action eq 'directorysrch') || ($action eq 'trust') || ($action eq 'helpsettings') || |
($action eq 'contacts')) { |
($action eq 'contacts')) { |
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'passwords') { |
|
$output .= $item->{'print'}->('top',$dom,$confname,$settings,\$rowtotal); |
} elsif ($action eq 'coursecategories') { |
} elsif ($action eq 'coursecategories') { |
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal); |
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal); |
} elsif ($action eq 'scantron') { |
} elsif ($action eq 'scantron') { |
Line 861 sub print_config_box {
|
Line 879 sub print_config_box {
|
if (($action eq 'autoupdate') || ($action eq 'usercreation') || |
if (($action eq 'autoupdate') || ($action eq 'usercreation') || |
($action eq 'selfcreation') || ($action eq 'selfenrollment') || |
($action eq 'selfcreation') || ($action eq 'selfenrollment') || |
($action eq 'usersessions') || ($action eq 'coursecategories') || |
($action eq 'usersessions') || ($action eq 'coursecategories') || |
($action eq 'trust') || ($action eq 'contacts') || ($action eq 'defaults')) { |
($action eq 'trust') || ($action eq 'contacts') || ($action eq 'passwords')) { |
if ($action eq 'coursecategories') { |
if ($action eq 'coursecategories') { |
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); |
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
} elsif ($action eq 'trust') { |
} elsif ($action eq 'trust') { |
$output .= $item->{'print'}->('shared',$dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->('shared',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'passwords') { |
|
$output .= $item->{'print'}->('middle',$dom,$confname,$settings,\$rowtotal); |
} else { |
} else { |
$output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal); |
} |
} |
Line 912 sub print_config_box {
|
Line 932 sub print_config_box {
|
</tr>'."\n"; |
</tr>'."\n"; |
if ($action eq 'coursecategories') { |
if ($action eq 'coursecategories') { |
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
} elsif ($action eq 'contacts') { |
} elsif (($action eq 'contacts') || ($action eq 'passwords')) { |
$output .= $item->{'print'}->('lower',$dom,$settings,\$rowtotal).' |
if ($action eq 'passwords') { |
|
$output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal); |
|
} else { |
|
$output .= $item->{'print'}->('lower',$dom,$settings,\$rowtotal); |
|
} |
|
$output .= ' |
</tr> |
</tr> |
</table> |
</table> |
</td> |
</td> |
Line 923 sub print_config_box {
|
Line 948 sub print_config_box {
|
<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'}->[3]->{'col1'}).'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td> |
<td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</td></tr>'. |
<td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</td></tr>'."\n"; |
$item->{'print'}->('bottom',$dom,$settings,\$rowtotal).' |
if ($action eq 'passwords') { |
|
$output .= $item->{'print'}->('bottom',$dom,$confname,$settings,\$rowtotal); |
|
} else { |
|
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); |
|
} |
|
$output .= ' |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
Line 2857 function toggleLTI(form,setting,item) {
|
Line 2887 function toggleLTI(form,setting,item) {
|
} |
} |
} |
} |
} |
} |
for (var j=0; j<fieldsets.length; j++) { |
for (var j=0; j<fieldsets.length; j++) { |
if (setvis) { |
if (setvis) { |
fieldsets[j].style.display = 'block'; |
fieldsets[j].style.display = 'block'; |
} else { |
} else { |
Line 2876 function toggleLTI(form,setting,item) {
|
Line 2906 function toggleLTI(form,setting,item) {
|
radioname = 'lti_mapcrs_'+item; |
radioname = 'lti_mapcrs_'+item; |
divid = 'lti_crsfield_'+item; |
divid = 'lti_crsfield_'+item; |
} else { |
} else { |
radioname = 'lti_passbackformat_'+item; |
radioname = 'lti_passback_'+item; |
divid = 'lti_passback_'+item; |
divid = 'lti_passback_'+item; |
} |
} |
var num = form.elements[radioname].length; |
var num = form.elements[radioname].length; |
Line 3383 sub print_contacts {
|
Line 3413 sub print_contacts {
|
} |
} |
} elsif ($position eq 'middle') { |
} elsif ($position eq 'middle') { |
@mailings = ('errormail','packagesmail','lonstatusmail','requestsmail', |
@mailings = ('errormail','packagesmail','lonstatusmail','requestsmail', |
'updatesmail','idconflictsmail'); |
'updatesmail','idconflictsmail','hostipmail'); |
foreach my $type (@mailings) { |
foreach my $type (@mailings) { |
$otheremails{$type} = ''; |
$otheremails{$type} = ''; |
} |
} |
Line 3466 sub print_contacts {
|
Line 3496 sub print_contacts {
|
$checked{'requestsmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'requestsmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'updatesmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'updatesmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'idconflictsmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'idconflictsmail'}{'adminemail'} = ' checked="checked" '; |
|
$checked{'hostipmail'}{'adminemail'} = ' checked="checked" '; |
} elsif ($position eq 'bottom') { |
} elsif ($position eq 'bottom') { |
$checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" '; |
$checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" '; |
$checked{'otherdomsmail'}{'supportemail'} = ' checked="checked" '; |
$checked{'otherdomsmail'}{'supportemail'} = ' checked="checked" '; |
Line 4814 sub print_lti {
|
Line 4845 sub print_lti {
|
if (!$requser) { |
if (!$requser) { |
$checkedrequser{'no'} = $checkedrequser{'yes'}; |
$checkedrequser{'no'} = $checkedrequser{'yes'}; |
$checkedrequser{'yes'} = ''; |
$checkedrequser{'yes'} = ''; |
} |
} |
my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_".$item."'".');"'; |
my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_".$item."'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
.'<select name="lti_pos_'.$item.'"'.$chgstr.'>'; |
.'<select name="lti_pos_'.$item.'"'.$chgstr.'>'; |
Line 5272 sub print_coursedefaults {
|
Line 5303 sub print_coursedefaults {
|
mysqltables => 'Lifetime (s) of "Temporary" MySQL tables (student performance data) on homeserver', |
mysqltables => 'Lifetime (s) of "Temporary" MySQL tables (student performance data) on homeserver', |
); |
); |
my %staticdefaults = ( |
my %staticdefaults = ( |
texengine => 'MathJax', |
|
anonsurvey_threshold => 10, |
anonsurvey_threshold => 10, |
uploadquota => 500, |
uploadquota => 500, |
postsubmit => 60, |
postsubmit => 60, |
Line 5286 sub print_coursedefaults {
|
Line 5316 sub print_coursedefaults {
|
'canclone' => 'none', |
'canclone' => 'none', |
); |
); |
@toggles = ('canuse_pdfforms','uselcmath','usejsme'); |
@toggles = ('canuse_pdfforms','uselcmath','usejsme'); |
my $deftex = $staticdefaults{'texengine'}; |
my $deftex = $Apache::lonnet::deftex; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{'texengine'}) { |
if ($settings->{'texengine'}) { |
if ($settings->{'texengine'} =~ /^(MathJax|mimetex|tth)$/) { |
if ($settings->{'texengine'} =~ /^(MathJax|mimetex|tth)$/) { |
Line 5770 sub print_validation_rows {
|
Line 5800 sub print_validation_rows {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub print_passwords { |
|
my ($position,$dom,$confname,$settings,$rowtotal) = @_; |
|
my ($datatable,$css_class); |
|
my $itemcount = 0; |
|
my %titles = &Apache::lonlocal::texthash ( |
|
captcha => '"Forgot Password" CAPTCHA validation', |
|
link => 'Reset link expiration (hours)', |
|
case => 'Case-sensitive usernames/e-mail', |
|
prelink => 'Information required (form 1)', |
|
postlink => 'Information required (form 2)', |
|
emailsrc => 'LON-CAPA e-mail address type(s)', |
|
customtext => 'Domain specific text (HTML)', |
|
intauth_cost => 'Encryption cost for bcrypt (positive integer)', |
|
intauth_check => 'Check bcrypt cost if authenticated', |
|
intauth_switch => 'Existing crypt-based switched to bcrypt on authentication', |
|
permanent => 'Permanent e-mail address', |
|
critical => 'Critical notification address', |
|
notify => 'Notification address', |
|
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') { |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
my $shownlinklife = 2; |
|
my $prelink = 'both'; |
|
my (%casesens,%postlink,%emailsrc,$nostdtext,$customurl); |
|
if (ref($settings) eq 'HASH') { |
|
if ($settings->{resetlink} =~ /^\d+(|\.\d*)$/) { |
|
$shownlinklife = $settings->{resetlink}; |
|
} |
|
if (ref($settings->{resetcase}) eq 'ARRAY') { |
|
map { $casesens{$_} = 1; } (@{$settings->{resetcase}}); |
|
} |
|
if ($settings->{resetprelink} =~ /^(both|either)$/) { |
|
$prelink = $settings->{resetprelink}; |
|
} |
|
if (ref($settings->{resetpostlink}) eq 'HASH') { |
|
%postlink = %{$settings->{resetpostlink}}; |
|
} |
|
if (ref($settings->{resetemail}) eq 'ARRAY') { |
|
map { $emailsrc{$_} = 1; } (@{$settings->{resetemail}}); |
|
} |
|
if ($settings->{resetremove}) { |
|
$nostdtext = 1; |
|
} |
|
if ($settings->{resetcustom}) { |
|
$customurl = $settings->{resetcustom}; |
|
} |
|
} else { |
|
if (ref($types) eq 'ARRAY') { |
|
foreach my $item (@{$types}) { |
|
$casesens{$item} = 1; |
|
$postlink{$item} = ['username','email']; |
|
} |
|
} |
|
$casesens{'default'} = 1; |
|
$postlink{'default'} = ['username','email']; |
|
$prelink = 'both'; |
|
%emailsrc = ( |
|
permanent => 1, |
|
critical => 1, |
|
notify => 1, |
|
); |
|
} |
|
$datatable = &captcha_choice('passwords',$settings,$$rowtotal); |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'link'}.'</td>'. |
|
'<td class="LC_left_item">'. |
|
'<input type="textbox" value="'.$shownlinklife.'" '. |
|
'name="passwords_link" size="3" /></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'case'}.'</td>'. |
|
'<td class="LC_left_item">'; |
|
if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) { |
|
foreach my $item (@{$types}) { |
|
my $checkedcase; |
|
if ($casesens{$item}) { |
|
$checkedcase = ' checked="checked"'; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="passwords_case_sensitive" value="'. |
|
$item.'"'.$checkedcase.' />'.$usertypes->{$item}.'</label>'. |
|
'<span> '; |
|
} |
|
} |
|
my $checkedcase; |
|
if ($casesens{'default'}) { |
|
$checkedcase = ' checked="checked"'; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label><input type="checkbox" '. |
|
'name="passwords_case_sensitive" value="default"'.$checkedcase.' />'. |
|
$othertitle.'</label></span></td>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
my %checkedpre = ( |
|
both => ' checked="checked"', |
|
either => '', |
|
); |
|
if ($prelink eq 'either') { |
|
$checkedpre{either} = ' checked="checked"'; |
|
$checkedpre{both} = ''; |
|
} |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'prelink'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" name="passwords_prelink" value="both"'.$checkedpre{'both'}.' />'. |
|
&mt('Both username and e-mail address').'</label></span> '. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="passwords_prelink" value="either"'.$checkedpre{'either'}.' />'. |
|
&mt('Either username or e-mail address').'</label></span></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'postlink'}.'</td>'. |
|
'<td class="LC_left_item">'; |
|
my %postlinked; |
|
if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) { |
|
foreach my $item (@{$types}) { |
|
undef(%postlinked); |
|
$datatable .= '<fieldset style="display: inline-block;">'. |
|
'<legend>'.$usertypes->{$item}.'</legend>'; |
|
if (ref($postlink{$item}) eq 'ARRAY') { |
|
map { $postlinked{$_} = 1; } (@{$postlink{$item}}); |
|
} |
|
foreach my $field ('email','username') { |
|
my $checked; |
|
if ($postlinked{$field}) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="passwords_postlink_'.$item.'" value="'. |
|
$field.'"'.$checked.' />'.$field.'</label>'. |
|
'<span> '; |
|
} |
|
$datatable .= '</fieldset>'; |
|
} |
|
} |
|
if (ref($postlink{'default'}) eq 'ARRAY') { |
|
map { $postlinked{$_} = 1; } (@{$postlink{'default'}}); |
|
} |
|
$datatable .= '<fieldset style="display: inline-block;">'. |
|
'<legend>'.$othertitle.'</legend>'; |
|
foreach my $field ('email','username') { |
|
my $checked; |
|
if ($postlinked{$field}) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="passwords_postlink_default" value="'. |
|
$field.'"'.$checked.' />'.$field.'</label>'. |
|
'<span> '; |
|
} |
|
$datatable .= '</fieldset></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'emailsrc'}.'</td>'. |
|
'<td class="LC_left_item">'; |
|
foreach my $type ('permanent','critical','notify') { |
|
my $checkedemail; |
|
if ($emailsrc{$type}) { |
|
$checkedemail = ' checked="checked"'; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="passwords_emailsrc" value="'. |
|
$type.'"'.$checkedemail.' />'.$titles{$type}.'</label>'. |
|
'<span> '; |
|
} |
|
$datatable .= '</td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
my $switchserver = &check_switchserver($dom,$confname); |
|
my ($showstd,$noshowstd); |
|
if ($nostdtext) { |
|
$noshowstd = ' checked="checked"'; |
|
} else { |
|
$showstd = ' checked="checked"'; |
|
} |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'customtext'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
&mt('Retain standard text:'). |
|
'<label><input type="radio" name="passwords_stdtext" value="1"'.$showstd.' />'. |
|
&mt('Yes').'</label>'.' '. |
|
'<label><input type="radio" name="passwords_stdtext" value="0"'.$noshowstd.' />'. |
|
&mt('No').'</label></span><br />'. |
|
'<span class="LC_fontsize_small">'. |
|
&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, |
|
undef,undef,undef,undef,'background-color:#ffffff'); |
|
$datatable .= '<span class="LC_nobreak"> '.$link. |
|
'<label><input type="checkbox" name="passwords_custom_del"'. |
|
' value="1" />'.&mt('Delete?').'</label></span>'. |
|
' <span class="LC_nobreak"> '.&mt('Replace:').'</span>'; |
|
} |
|
if ($switchserver) { |
|
$datatable .= '<span class="LC_nobreak"> '.&mt('Upload to library server: [_1]',$switchserver).'</span>'; |
|
} else { |
|
$datatable .='<span class="LC_nobreak"> '. |
|
'<input type="file" name="passwords_customfile" /></span>'; |
|
} |
|
$datatable .= '</td></tr>'; |
|
} elsif ($position eq 'middle') { |
|
my %domconf = &Apache::lonnet::get_dom('configuration',['defaults'],$dom); |
|
my @items = ('intauth_cost','intauth_check','intauth_switch'); |
|
my %defaults; |
|
if (ref($domconf{'defaults'}) eq 'HASH') { |
|
%defaults = %{$domconf{'defaults'}}; |
|
if ($defaults{'intauth_cost'} !~ /^\d+$/) { |
|
$defaults{'intauth_cost'} = 10; |
|
} |
|
if ($defaults{'intauth_check'} !~ /^(0|1|2)$/) { |
|
$defaults{'intauth_check'} = 0; |
|
} |
|
if ($defaults{'intauth_switch'} !~ /^(0|1|2)$/) { |
|
$defaults{'intauth_switch'} = 0; |
|
} |
|
} else { |
|
%defaults = ( |
|
'intauth_cost' => 10, |
|
'intauth_check' => 0, |
|
'intauth_switch' => 0, |
|
); |
|
} |
|
foreach my $item (@items) { |
|
if ($itemcount%2) { |
|
$css_class = ''; |
|
} else { |
|
$css_class = ' class="LC_odd_row" '; |
|
} |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td><span class="LC_nobreak">'.$titles{$item}. |
|
'</span></td><td class="LC_left_item" colspan="3">'; |
|
if ($item eq 'intauth_switch') { |
|
my @options = (0,1,2); |
|
my %optiondesc = &Apache::lonlocal::texthash ( |
|
0 => 'No', |
|
1 => 'Yes', |
|
2 => 'Yes, and copy existing passwd file to passwd.bak file', |
|
); |
|
$datatable .= '<table width="100%">'; |
|
foreach my $option (@options) { |
|
my $checked = ' '; |
|
if ($defaults{$item} eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$datatable .= '<tr><td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" name="'.$item. |
|
'" value="'.$option.'"'.$checked.' />'. |
|
$optiondesc{$option}.'</label></span></td></tr>'; |
|
} |
|
$datatable .= '</table>'; |
|
} elsif ($item eq 'intauth_check') { |
|
my @options = (0,1,2); |
|
my %optiondesc = &Apache::lonlocal::texthash ( |
|
0 => 'No', |
|
1 => 'Yes, allow login then update passwd file using default cost (if higher)', |
|
2 => 'Yes, disallow login if stored cost is less than domain default', |
|
); |
|
$datatable .= '<table width="100%">'; |
|
foreach my $option (@options) { |
|
my $checked = ' '; |
|
my $onclick; |
|
if ($defaults{$item} eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
if ($option == 2) { |
|
$onclick = ' onclick="javascript:warnIntAuth(this);"'; |
|
} |
|
$datatable .= '<tr><td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" name="'.$item. |
|
'" value="'.$option.'"'.$checked.$onclick.' />'. |
|
$optiondesc{$option}.'</label></span></td></tr>'; |
|
} |
|
$datatable .= '</table>'; |
|
} else { |
|
$datatable .= '<input type="text" name="'.$item.'" value="'. |
|
$defaults{$item}.'" size="3" onblur="javascript:warnIntAuth(this);" />'; |
|
} |
|
$datatable .= '</td></tr>'; |
|
$itemcount ++; |
|
} |
|
} elsif ($position eq 'lower') { |
|
my ($min,$max,%chars,$expire,$numsaved); |
|
if (ref($settings) eq 'HASH') { |
|
if ($settings->{min}) { |
|
$min = $settings->{min}; |
|
} |
|
if ($settings->{max}) { |
|
$max = $settings->{max}; |
|
} |
|
if (ref($settings->{chars}) eq 'ARRAY') { |
|
map { $chars{$_} = 1; } (@{$settings->{chars}}); |
|
} |
|
if ($settings->{expire}) { |
|
$expire = $settings->{expire}; |
|
} |
|
if ($settings->(numsaved}) { |
|
$numsaved = $settings->(numsaved}; |
|
} |
|
} else { |
|
$min = '7'; |
|
} |
|
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', |
|
); |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'min'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="passwords_min" value="'.$min.'" size="3" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Leave blank for no minimum)').'</span>'. |
|
'</span></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'max'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="passwords_max" value="'.$max.'" size="3" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Leave blank for no maximum)').'</span>'. |
|
'</span></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'chars'}.'<br />'. |
|
'<span class="LC_nobreak LC_fontsize_small">'.&mt('(Leave unchecked if not required)'). |
|
'</span></td>'; |
|
my $numinrow = 2; |
|
my @possrules = ('uc','lc','num','spec'); |
|
$datatable .= '<td class="LC_left_item"><table>'; |
|
for (my $i=0; $i<@possrules; $i++) { |
|
my ($rem,$checked); |
|
if ($chars{$possrules[$i]}) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$datatable .= '</tr>'; |
|
} |
|
$datatable .= '<tr>'; |
|
} |
|
$datatable .= '<td><span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="passwords_chars" value="'.$possrules[$i].'"'.$checked.' />'. |
|
$rulenames{$possrules[$i]}.'</label></span></td>'; |
|
} |
|
my $rem = @possrules%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$datatable .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$datatable .='</table></td></tr>'; |
|
$itemcount ++; |
|
$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="passwords_expire" value="'.$expire.'" size="4" />'. |
|
'<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="passwords_numsaved" value="'.$numsaved.'" size="3" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Leave blank to not save previous passwords)').'</span>'. |
|
'</span></td></tr>'; |
|
} else { |
|
my $checkedon; |
|
my $checkedoff = ' checked="checked"'; |
|
if (ref($settings) eq 'HASH') { |
|
if ($settings->{crsownerchg}) { |
|
$checkedon = $checkedoff; |
|
$checkedoff = ''; |
|
} |
|
} |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr '.$css_class.'>'. |
|
'<td>'. |
|
&mt('Requirements').'<ul>'. |
|
'<li>'.&mt("Course 'type' is not a Community").'</li>'. |
|
'<li>'.&mt('User is Course Coordinator and also course owner').'</li>'. |
|
'<li>'.&mt("Student's only active roles are student role(s) in course(s) owned by this user").'</li>'. |
|
'</ul>'. |
|
'</td>'. |
|
'<td class="LC_left_item" colspan="2"><span class="LC_nobreak">'. |
|
'<label><input type="radio" name="passwords_crsowner" value="1"'.$checkedon.' />'.&mt('Yes').'</label></span> '. |
|
'<span class="LC_nobreak"><label><input type="radio" name="passwords_crsowner" value="0"'.$checkedoff.' />'. |
|
&mt('No').'</label></span>'. |
|
'</td></tr>'; |
|
|
|
} |
|
return $datatable; |
|
} |
|
|
sub print_usersessions { |
sub print_usersessions { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($css_class,$datatable,$itemcount,%checked,%choices); |
my ($css_class,$datatable,$itemcount,%checked,%choices); |
Line 6786 sub contact_titles {
|
Line 7216 sub contact_titles {
|
'requestsmail' => 'E-mail from course requests requiring approval', |
'requestsmail' => 'E-mail from course requests requiring approval', |
'updatesmail' => 'E-mail from nightly check of LON-CAPA module integrity/updates', |
'updatesmail' => 'E-mail from nightly check of LON-CAPA module integrity/updates', |
'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID', |
'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID', |
|
'hostipmail' => 'E-mail from nightly check of hostname/IP network changes', |
'errorthreshold' => 'Error/warning threshold for status e-mail', |
'errorthreshold' => 'Error/warning threshold for status e-mail', |
'errorsysmail' => 'Error threshold for e-mail to core group', |
'errorsysmail' => 'Error threshold for e-mail to core group', |
'errorweights' => 'Weights used to compute error count', |
'errorweights' => 'Weights used to compute error count', |
Line 7527 sub captcha_choice {
|
Line 7958 sub captcha_choice {
|
$vertext,$currver); |
$vertext,$currver); |
my %lt = &captcha_phrases(); |
my %lt = &captcha_phrases(); |
$keyentry = 'hidden'; |
$keyentry = 'hidden'; |
|
my $colspan=2; |
if ($context eq 'cancreate') { |
if ($context eq 'cancreate') { |
$rowname = &mt('CAPTCHA validation'); |
$rowname = &mt('CAPTCHA validation'); |
} elsif ($context eq 'login') { |
} elsif ($context eq 'login') { |
$rowname = &mt('"Contact helpdesk" CAPTCHA validation'); |
$rowname = &mt('"Contact helpdesk" CAPTCHA validation'); |
|
} elsif ($context eq 'passwords') { |
|
$rowname = &mt('"Forgot Password" CAPTCHA validation'); |
|
$colspan=1; |
} |
} |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{'captcha'}) { |
if ($settings->{'captcha'}) { |
Line 7570 sub captcha_choice {
|
Line 8005 sub captcha_choice {
|
$css_class .= ' style="'.$rowstyle.'"'; |
$css_class .= ' style="'.$rowstyle.'"'; |
} |
} |
my $output = '<tr'.$css_class.'>'. |
my $output = '<tr'.$css_class.'>'. |
'<td class="LC_left_item">'.$rowname.'</td><td class="LC_left_item" colspan="2">'."\n". |
'<td class="LC_left_item">'.$rowname.'</td><td class="LC_left_item" colspan="'.$colspan.'">'."\n". |
'<table><tr><td>'."\n"; |
'<table><tr><td>'."\n"; |
foreach my $option ('original','recaptcha','notused') { |
foreach my $option ('original','recaptcha','notused') { |
$output .= '<span class="LC_nobreak"><label><input type="radio" name="'.$context.'_captcha" value="'. |
$output .= '<span class="LC_nobreak"><label><input type="radio" name="'.$context.'_captcha" value="'. |
Line 7809 sub print_defaults {
|
Line 8244 sub print_defaults {
|
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
$rownum ++; |
$rownum ++; |
} |
} |
} elsif ($position eq 'middle') { |
|
my @items = ('intauth_cost','intauth_check','intauth_switch'); |
|
my %defaults; |
|
if (ref($settings) eq 'HASH') { |
|
%defaults = %{$settings}; |
|
if ($defaults{'intauth_cost'} !~ /^\d+$/) { |
|
$defaults{'intauth_cost'} = 10; |
|
} |
|
if ($defaults{'intauth_check'} !~ /^(0|1|2)$/) { |
|
$defaults{'intauth_check'} = 0; |
|
} |
|
if ($defaults{'intauth_switch'} !~ /^(0|1|2)$/) { |
|
$defaults{'intauth_switch'} = 0; |
|
} |
|
} else { |
|
%defaults = ( |
|
'intauth_cost' => 10, |
|
'intauth_check' => 0, |
|
'intauth_switch' => 0, |
|
); |
|
} |
|
foreach my $item (@items) { |
|
if ($rownum%2) { |
|
$css_class = ''; |
|
} else { |
|
$css_class = ' class="LC_odd_row" '; |
|
} |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td><span class="LC_nobreak">'.$titles->{$item}. |
|
'</span></td><td class="LC_left_item" colspan="3">'; |
|
if ($item eq 'intauth_switch') { |
|
my @options = (0,1,2); |
|
my %optiondesc = &Apache::lonlocal::texthash ( |
|
0 => 'No', |
|
1 => 'Yes', |
|
2 => 'Yes, and copy existing passwd file to passwd.bak file', |
|
); |
|
$datatable .= '<table width="100%">'; |
|
foreach my $option (@options) { |
|
my $checked = ' '; |
|
if ($defaults{$item} eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$datatable .= '<tr><td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" name="'.$item. |
|
'" value="'.$option.'"'.$checked.' />'. |
|
$optiondesc{$option}.'</label></span></td></tr>'; |
|
} |
|
$datatable .= '</table>'; |
|
} elsif ($item eq 'intauth_check') { |
|
my @options = (0,1,2); |
|
my %optiondesc = &Apache::lonlocal::texthash ( |
|
0 => 'No', |
|
1 => 'Yes, allow login then update passwd file using default cost (if higher)', |
|
2 => 'Yes, disallow login if stored cost is less than domain default', |
|
); |
|
$datatable .= '<table width="100%">'; |
|
foreach my $option (@options) { |
|
my $checked = ' '; |
|
my $onclick; |
|
if ($defaults{$item} eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
if ($option == 2) { |
|
$onclick = ' onclick="javascript:warnIntAuth(this);"'; |
|
} |
|
$datatable .= '<tr><td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" name="'.$item. |
|
'" value="'.$option.'"'.$checked.$onclick.' />'. |
|
$optiondesc{$option}.'</label></span></td></tr>'; |
|
} |
|
$datatable .= '</table>'; |
|
} else { |
|
$datatable .= '<input type="text" name="'.$item.'" value="'. |
|
$defaults{$item}.'" size="3" onblur="javascript:warnIntAuth(this);" />'; |
|
} |
|
$datatable .= '</td></tr>'; |
|
$rownum ++; |
|
} |
|
} else { |
} else { |
my %defaults; |
my %defaults; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
Line 7996 sub scantron_javascript {
|
Line 8352 sub scantron_javascript {
|
// <![CDATA[ |
// <![CDATA[ |
|
|
function toggleScantron(form) { |
function toggleScantron(form) { |
|
var csvfieldset = new Array(); |
if (document.getElementById('scantroncsv_cols')) { |
if (document.getElementById('scantroncsv_cols')) { |
var csvfieldset = document.getElementById('scantroncsv_cols'); |
csvfieldset.push(document.getElementById('scantroncsv_cols')); |
|
} |
|
if (document.getElementById('scantroncsv_options')) { |
|
csvfieldset.push(document.getElementById('scantroncsv_options')); |
|
} |
|
if (csvfieldset.length) { |
if (document.getElementById('scantronconfcsv')) { |
if (document.getElementById('scantronconfcsv')) { |
var scantroncsv = document.getElementById('scantronconfcsv'); |
var scantroncsv = document.getElementById('scantronconfcsv'); |
if (scantroncsv.checked) { |
if (scantroncsv.checked) { |
csvfieldset.style.display = 'inline-block'; |
for (var i=0; i<csvfieldset.length; i++) { |
|
csvfieldset[i].style.display = 'block'; |
|
} |
} else { |
} else { |
csvfieldset.style.display = 'none'; |
for (var i=0; i<csvfieldset.length; i++) { |
|
csvfieldset[i].style.display = 'none'; |
|
} |
var csvselects = document.getElementsByClassName('scantronconfig_csv'); |
var csvselects = document.getElementsByClassName('scantronconfig_csv'); |
if (csvselects.length) { |
if (csvselects.length) { |
for (var j=0; j<csvselects.length; j++) { |
for (var j=0; j<csvselects.length; j++) { |
Line 8199 sub print_scantronconfig {
|
Line 8565 sub print_scantronconfig {
|
my ($dom,$settings,$rowtotal) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my $itemcount = 2; |
my $itemcount = 2; |
my $is_checked = ' checked="checked"'; |
my $is_checked = ' checked="checked"'; |
|
my %optionson = ( |
|
hdr => ' checked="checked"', |
|
pad => ' checked="checked"', |
|
rem => ' checked="checked"', |
|
); |
|
my %optionsoff = ( |
|
hdr => '', |
|
pad => '', |
|
rem => '', |
|
); |
my $currcsvsty = 'none'; |
my $currcsvsty = 'none'; |
my ($datatable,%csvfields,%checked,%onclick); |
my ($datatable,%csvfields,%checked,%onclick,%csvoptions); |
my @fields = &scantroncsv_fields(); |
my @fields = &scantroncsv_fields(); |
my %titles = &scantronconfig_titles(); |
my %titles = &scantronconfig_titles(); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
Line 8209 sub print_scantronconfig {
|
Line 8585 sub print_scantronconfig {
|
$checked{'dat'} = $is_checked; |
$checked{'dat'} = $is_checked; |
} |
} |
if (ref($settings->{config}->{csv}) eq 'HASH') { |
if (ref($settings->{config}->{csv}) eq 'HASH') { |
%csvfields = %{$settings->{config}->{csv}}; |
if (ref($settings->{config}->{csv}->{fields}) eq 'HASH') { |
if (keys(%csvfields) > 0) { |
%csvfields = %{$settings->{config}->{csv}->{fields}}; |
$checked{'csv'} = $is_checked; |
if (keys(%csvfields) > 0) { |
$currcsvsty = 'inline-block'; |
$checked{'csv'} = $is_checked; |
|
$currcsvsty = 'block'; |
|
} |
|
} |
|
if (ref($settings->{config}->{csv}->{options}) eq 'HASH') { |
|
%csvoptions = %{$settings->{config}->{csv}->{options}}; |
|
foreach my $option (keys(%optionson)) { |
|
unless ($csvoptions{$option}) { |
|
$optionsoff{$option} = $optionson{$option}; |
|
$optionson{$option} = ''; |
|
} |
|
} |
} |
} |
} |
} |
} else { |
} else { |
Line 8229 sub print_scantronconfig {
|
Line 8616 sub print_scantronconfig {
|
my $id; |
my $id; |
if ($item eq 'csv') { |
if ($item eq 'csv') { |
$id = 'id="scantronconfcsv" '; |
$id = 'id="scantronconfcsv" '; |
} |
} |
$datatable .= '<label><input type="checkbox" name="scantronconfig" '.$id.'value="'.$item.'"'.$checked{$item}.$onclick{$item}.' />'. |
$datatable .= '<label><input type="checkbox" name="scantronconfig" '.$id.'value="'.$item.'"'.$checked{$item}.$onclick{$item}.' />'. |
$titles{$item}.'</label>'.(' 'x3); |
$titles{$item}.'</label>'.(' 'x3); |
if ($item eq 'csv') { |
if ($item eq 'csv') { |
Line 8258 sub print_scantronconfig {
|
Line 8645 sub print_scantronconfig {
|
} |
} |
$datatable .= '</select></td></tr>'; |
$datatable .= '</select></td></tr>'; |
} |
} |
$datatable .= '</table></fieldset>'; |
$datatable .= '</table></fieldset>'. |
|
'<fieldset style="display:'.$currcsvsty.'" id="scantroncsv_options">'. |
|
'<legend>'.&mt('CSV Options').'</legend>'; |
|
foreach my $option ('hdr','pad','rem') { |
|
$datatable .= '<span class="LC_nobreak">'.$titles{$option}.':'. |
|
'<label><input type="radio" name="scantroncsv_'.$option.'" value="1"'.$optionson{$option}.' />'. |
|
&mt('Yes').'</label>'.(' 'x2)."\n". |
|
'<label><input type="radio" name="scantroncsv_'.$option.'" value="0"'.$optionsoff{$option}.' />'.&mt('No').'</label></span><br />'; |
|
} |
|
$datatable .= '</fieldset>'; |
$itemcount ++; |
$itemcount ++; |
} |
} |
} |
} |
Line 8271 sub scantronconfig_titles {
|
Line 8667 sub scantronconfig_titles {
|
return &Apache::lonlocal::texthash( |
return &Apache::lonlocal::texthash( |
dat => 'Standard format (.dat)', |
dat => 'Standard format (.dat)', |
csv => 'Comma separated values (.csv)', |
csv => 'Comma separated values (.csv)', |
|
hdr => 'Remove first line in file (contains column titles)', |
|
pad => 'Prepend 0s to PaperID', |
|
rem => 'Remove leading spaces (except Question Response columns)', |
CODE => 'CODE', |
CODE => 'CODE', |
ID => 'Student ID', |
ID => 'Student ID', |
PaperID => 'Paper ID', |
PaperID => 'Paper ID', |
Line 8633 sub serverstatus_pages {
|
Line 9032 sub serverstatus_pages {
|
|
|
sub defaults_javascript { |
sub defaults_javascript { |
my ($settings) = @_; |
my ($settings) = @_; |
my $intauthcheck = &mt('Warning: disallowing login for an authenticated user if the stored cost is less than the default will require a password reset by/for the user.'); |
return unless (ref($settings) eq 'HASH'); |
my $intauthcost = &mt('Warning: bcrypt encryption cost for internal authentication must be an integer.'); |
|
&js_escape(\$intauthcheck); |
|
&js_escape(\$intauthcost); |
|
my $intauthjs = <<"ENDSCRIPT"; |
|
|
|
function warnIntAuth(field) { |
|
if (field.name == 'intauth_check') { |
|
if (field.value == '2') { |
|
alert('$intauthcheck'); |
|
} |
|
} |
|
if (field.name == 'intauth_cost') { |
|
field.value.replace(/\s/g,''); |
|
if (field.value != '') { |
|
var regexdigit=/^\\d+\$/; |
|
if (!regexdigit.test(field.value)) { |
|
alert('$intauthcost'); |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
ENDSCRIPT |
|
|
|
if (ref($settings) ne 'HASH') { |
|
return &Apache::lonhtmlcommon::scripttag($intauthjs); |
|
} |
|
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { |
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { |
my $maxnum = scalar(@{$settings->{'inststatusorder'}}); |
my $maxnum = scalar(@{$settings->{'inststatusorder'}}); |
if ($maxnum eq '') { |
if ($maxnum eq '') { |
Line 8715 $jstext
|
Line 9086 $jstext
|
return; |
return; |
} |
} |
|
|
$intauthjs |
|
|
|
// ]]> |
// ]]> |
</script> |
</script> |
|
|
ENDSCRIPT |
ENDSCRIPT |
} else { |
|
return &Apache::lonhtmlcommon::scripttag($intauthjs); |
|
} |
} |
|
return; |
|
} |
|
|
|
sub passwords_javascript { |
|
my $intauthcheck = &mt('Warning: disallowing login for an authenticated user if the stored cost is less than the default will require a password reset by/for the user.'); |
|
my $intauthcost = &mt('Warning: bcrypt encryption cost for internal authentication must be an integer.'); |
|
&js_escape(\$intauthcheck); |
|
&js_escape(\$intauthcost); |
|
my $intauthjs = <<"ENDSCRIPT"; |
|
|
|
function warnIntAuth(field) { |
|
if (field.name == 'intauth_check') { |
|
if (field.value == '2') { |
|
alert('$intauthcheck'); |
|
} |
|
} |
|
if (field.name == 'intauth_cost') { |
|
field.value.replace(/\s/g,''); |
|
if (field.value != '') { |
|
var regexdigit=/^\\d+\$/; |
|
if (!regexdigit.test(field.value)) { |
|
alert('$intauthcost'); |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
ENDSCRIPT |
|
return &Apache::lonhtmlcommon::scripttag($intauthjs); |
} |
} |
|
|
sub coursecategories_javascript { |
sub coursecategories_javascript { |
Line 9078 sub modifiable_userdata_row {
|
Line 9475 sub modifiable_userdata_row {
|
my $check = ' '; |
my $check = ' '; |
unless ($role eq 'emailusername') { |
unless ($role eq 'emailusername') { |
if (exists($checks{$fields[$i]})) { |
if (exists($checks{$fields[$i]})) { |
$check = $checks{$fields[$i]} |
$check = $checks{$fields[$i]}; |
} elsif ($context ne 'lti') { |
} elsif ($context ne 'lti') { |
if ($role eq 'st') { |
if ($role eq 'st') { |
if (ref($settings) ne 'HASH') { |
if (ref($settings) ne 'HASH') { |
Line 12993 sub modify_contacts {
|
Line 13390 sub modify_contacts {
|
my (%others,%to,%bcc,%includestr,%includeloc); |
my (%others,%to,%bcc,%includestr,%includeloc); |
my @contacts = ('supportemail','adminemail'); |
my @contacts = ('supportemail','adminemail'); |
my @mailings = ('errormail','packagesmail','helpdeskmail','otherdomsmail', |
my @mailings = ('errormail','packagesmail','helpdeskmail','otherdomsmail', |
'lonstatusmail','requestsmail','updatesmail','idconflictsmail'); |
'lonstatusmail','requestsmail','updatesmail','idconflictsmail','hostipmail'); |
my @toggles = ('reporterrors','reportupdates','reportstatus'); |
my @toggles = ('reporterrors','reportupdates','reportstatus'); |
my @lonstatus = ('threshold','sysmail','weights','excluded'); |
my @lonstatus = ('threshold','sysmail','weights','excluded'); |
my ($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields(); |
my ($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields(); |
Line 13282 sub modify_contacts {
|
Line 13679 sub modify_contacts {
|
$default{'lonstatusmail'} = 'adminemail'; |
$default{'lonstatusmail'} = 'adminemail'; |
$default{'requestsmail'} = 'adminemail'; |
$default{'requestsmail'} = 'adminemail'; |
$default{'updatesmail'} = 'adminemail'; |
$default{'updatesmail'} = 'adminemail'; |
|
$default{'hostipmail'} = 'adminemail'; |
foreach my $item (@contacts) { |
foreach my $item (@contacts) { |
if ($to{$item} ne $default{$item}) { |
if ($to{$item} ne $default{$item}) { |
$changes{$item} = 1; |
$changes{$item} = 1; |
Line 13571 sub modify_contacts {
|
Line 13969 sub modify_contacts {
|
return $resulttext; |
return $resulttext; |
} |
} |
|
|
|
sub modify_passwords { |
|
my ($r,$dom,$confname,$lastactref,%domconfig) = @_; |
|
my ($resulttext,%current,%changes,%newvalues,@oktypes,$errors, |
|
$updatedefaults,$updateconf); |
|
my $customfn = 'resetpw.html'; |
|
if (ref($domconfig{'passwords'}) eq 'HASH') { |
|
%current = %{$domconfig{'passwords'}}; |
|
} |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
if (ref($types) eq 'ARRAY') { |
|
@oktypes = @{$types}; |
|
} |
|
push(@oktypes,'default'); |
|
|
|
my %titles = &Apache::lonlocal::texthash ( |
|
intauth_cost => 'Encryption cost for bcrypt (positive integer)', |
|
intauth_check => 'Check bcrypt cost if authenticated', |
|
intauth_switch => 'Existing crypt-based switched to bcrypt on authentication', |
|
permanent => 'Permanent e-mail address', |
|
critical => 'Critical notification address', |
|
notify => 'Notification address', |
|
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)', |
|
rules => 'Rules for LON-CAPA Passwords', |
|
crsownerchg => 'Course Owner Changing Student Passwords', |
|
username => 'Username', |
|
email => 'E-mail address', |
|
); |
|
|
|
# |
|
# Retrieve current domain configuration for internal authentication from $domconfig{'defaults'}. |
|
# |
|
my (%curr_defaults,%save_defaults); |
|
if (ref($domconfig{'defaults'}) eq 'HASH') { |
|
foreach my $key (keys(%{$domconfig{'defaults'}})) { |
|
if ($key =~ /^intauth_(cost|check|switch)$/) { |
|
$curr_defaults{$key} = $domconfig{'defaults'}{$key}; |
|
} else { |
|
$save_defaults{$key} = $domconfig{'defaults'}{$key}; |
|
} |
|
} |
|
} |
|
my %staticdefaults = ( |
|
'resetlink' => 2, |
|
'resetcase' => \@oktypes, |
|
'resetprelink' => 'both', |
|
'resetemail' => ['critical','notify','permanent'], |
|
'intauth_cost' => 10, |
|
'intauth_check' => 0, |
|
'intauth_switch' => 0, |
|
'min' => 7, |
|
); |
|
foreach my $type (@oktypes) { |
|
$staticdefaults{'resetpostlink'}{$type} = ['email','username']; |
|
} |
|
my $linklife = $env{'form.passwords_link'}; |
|
$linklife =~ s/^\s+|\s+$//g; |
|
if (($linklife =~ /^\d+(|\.\d*)$/) && ($linklife > 0)) { |
|
$newvalues{'resetlink'} = $linklife; |
|
if ($current{'resetlink'}) { |
|
if ($current{'resetlink'} ne $linklife) { |
|
$changes{'reset'} = 1; |
|
} |
|
} elsif (!exists($domconfig{passwords})) { |
|
if ($staticdefaults{'resetlink'} ne $linklife) { |
|
$changes{'reset'} = 1; |
|
} |
|
} |
|
} elsif ($current{'resetlink'}) { |
|
$changes{'reset'} = 1; |
|
} |
|
my @casesens; |
|
my @posscase = &Apache::loncommon::get_env_multiple('form.passwords_case_sensitive'); |
|
foreach my $case (sort(@posscase)) { |
|
if (grep(/^\Q$case\E$/,@oktypes)) { |
|
push(@casesens,$case); |
|
} |
|
} |
|
$newvalues{'resetcase'} = \@casesens; |
|
if (ref($current{'resetcase'}) eq 'ARRAY') { |
|
my @diffs = &Apache::loncommon::compare_arrays($current{'resetcase'},\@casesens); |
|
if (@diffs > 0) { |
|
$changes{'reset'} = 1; |
|
} |
|
} elsif (!exists($domconfig{passwords})) { |
|
my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetcase'},\@casesens); |
|
if (@diffs > 0) { |
|
$changes{'reset'} = 1; |
|
} |
|
} |
|
if ($env{'form.passwords_prelink'} =~ /^(both|either)$/) { |
|
$newvalues{'resetprelink'} = $env{'form.passwords_prelink'}; |
|
if (exists($current{'resetprelink'})) { |
|
if ($current{'resetprelink'} ne $newvalues{'resetprelink'}) { |
|
$changes{'reset'} = 1; |
|
} |
|
} elsif (!exists($domconfig{passwords})) { |
|
if ($staticdefaults{'resetprelink'} ne $newvalues{'resetprelink'}) { |
|
$changes{'reset'} = 1; |
|
} |
|
} |
|
} elsif ($current{'resetprelink'}) { |
|
$changes{'reset'} = 1; |
|
} |
|
foreach my $type (@oktypes) { |
|
my @possplink = &Apache::loncommon::get_env_multiple('form.passwords_postlink_'.$type); |
|
my @postlink; |
|
foreach my $item (sort(@possplink)) { |
|
if ($item =~ /^(email|username)$/) { |
|
push(@postlink,$item); |
|
} |
|
} |
|
$newvalues{'resetpostlink'}{$type} = \@postlink; |
|
unless ($changes{'reset'}) { |
|
if (ref($current{'resetpostlink'}) eq 'HASH') { |
|
if (ref($current{'resetpostlink'}{$type}) eq 'ARRAY') { |
|
my @diffs = &Apache::loncommon::compare_arrays($current{'resetpostlink'}{$type},\@postlink); |
|
if (@diffs > 0) { |
|
$changes{'reset'} = 1; |
|
} |
|
} else { |
|
$changes{'reset'} = 1; |
|
} |
|
} elsif (!exists($domconfig{passwords})) { |
|
my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetpostlink'}{$type},\@postlink); |
|
if (@diffs > 0) { |
|
$changes{'reset'} = 1; |
|
} |
|
} |
|
} |
|
} |
|
my @possemailsrc = &Apache::loncommon::get_env_multiple('form.passwords_emailsrc'); |
|
my @resetemail; |
|
foreach my $item (sort(@possemailsrc)) { |
|
if ($item =~ /^(permanent|critical|notify)$/) { |
|
push(@resetemail,$item); |
|
} |
|
} |
|
$newvalues{'resetemail'} = \@resetemail; |
|
unless ($changes{'reset'}) { |
|
if (ref($current{'resetemail'}) eq 'ARRAY') { |
|
my @diffs = &Apache::loncommon::compare_arrays($current{'resetemail'},\@resetemail); |
|
if (@diffs > 0) { |
|
$changes{'reset'} = 1; |
|
} |
|
} elsif (!exists($domconfig{passwords})) { |
|
my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetemail'},\@resetemail); |
|
if (@diffs > 0) { |
|
$changes{'reset'} = 1; |
|
} |
|
} |
|
} |
|
if ($env{'form.passwords_stdtext'} == 0) { |
|
$newvalues{'resetremove'} = 1; |
|
unless ($current{'resetremove'}) { |
|
$changes{'reset'} = 1; |
|
} |
|
} elsif ($current{'resetremove'}) { |
|
$changes{'reset'} = 1; |
|
} |
|
if ($env{'form.passwords_customfile.filename'} ne '') { |
|
my $servadm = $r->dir_config('lonAdmEMail'); |
|
my ($configuserok,$author_ok,$switchserver) = |
|
&config_check($dom,$confname,$servadm); |
|
my $error; |
|
if ($configuserok eq 'ok') { |
|
if ($switchserver) { |
|
$error = &mt("Upload of file containing domain-specific text is not permitted to this server: [_1]",$switchserver); |
|
} else { |
|
if ($author_ok eq 'ok') { |
|
my ($result,$customurl) = |
|
&publishlogo($r,'upload','passwords_customfile',$dom, |
|
$confname,'customtext/resetpw','','',$customfn); |
|
if ($result eq 'ok') { |
|
$newvalues{'resetcustom'} = $customurl; |
|
$changes{'reset'} = 1; |
|
} else { |
|
$error = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$customfn,$result); |
|
} |
|
} else { |
|
$error = &mt("Upload of [_1] failed because an author role could not be assigned to a Domain Configuration user ([_2]) in domain: [_3]. Error was: [_4].",$customfn,$confname,$dom,$author_ok); |
|
} |
|
} |
|
} else { |
|
$error = &mt("Upload of [_1] failed because a Domain Configuration user ([_2]) could not be created in domain: [_3]. Error was: [_4].",$customfn,$confname,$dom,$configuserok); |
|
} |
|
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} elsif ($current{'resetcustom'}) { |
|
if ($env{'form.passwords_custom_del'}) { |
|
$changes{'reset'} = 1; |
|
} else { |
|
$newvalues{'resetcustom'} = $current{'resetcustom'}; |
|
} |
|
} |
|
$env{'form.intauth_cost'} =~ s/^\s+|\s+$//g; |
|
if (($env{'form.intauth_cost'} ne '') && ($env{'form.intauth_cost'} =~ /^\d+$/)) { |
|
$save_defaults{'intauth_cost'} = $env{'form.intauth_cost'}; |
|
if ($save_defaults{'intauth_cost'} ne $curr_defaults{'intauth_cost'}) { |
|
$changes{'intauth'} = 1; |
|
} |
|
} else { |
|
$save_defaults{'intauth_cost'} = $curr_defaults{'intauth_cost'}; |
|
} |
|
if ($env{'form.intauth_check'} =~ /^(0|1|2)$/) { |
|
$save_defaults{'intauth_check'} = $env{'form.intauth_check'}; |
|
if ($save_defaults{'intauth_check'} ne $curr_defaults{'intauth_check'}) { |
|
$changes{'intauth'} = 1; |
|
} |
|
} else { |
|
$save_defaults{'intauth_check'} = $curr_defaults{'intauth_check'}; |
|
} |
|
if ($env{'form.intauth_switch'} =~ /^(0|1|2)$/) { |
|
$save_defaults{'intauth_switch'} = $env{'form.intauth_switch'}; |
|
if ($save_defaults{'intauth_switch'} ne $curr_defaults{'intauth_switch'}) { |
|
$changes{'intauth'} = 1; |
|
} |
|
} else { |
|
$save_defaults{'intauth_check'} = $curr_defaults{'intauth_check'}; |
|
} |
|
foreach my $item ('cost','check','switch') { |
|
if ($save_defaults{'intauth_'.$item} ne $domdefaults{'intauth_'.$item}) { |
|
$domdefaults{'intauth_'.$item} = $save_defaults{'intauth_'.$item}; |
|
$updatedefaults = 1; |
|
} |
|
} |
|
foreach my $rule ('min','max','expire','numsaved') { |
|
$env{'form.passwords_'.$rule} =~ s/^\s+|\s+$//g; |
|
my $ruleok; |
|
if ($rule eq 'expire') { |
|
if ($env{'form.passwords_'.$rule} =~ /^\d+(|\.\d*)$/) { |
|
$ruleok = 1; |
|
} |
|
} elsif ($env{'form.passwords_'.$rule} =~ /^\d+$/) { |
|
$ruleok = 1; |
|
} |
|
if ($ruleok) { |
|
$newvalues{$rule} = $env{'form.passwords_'.$rule}; |
|
if (exists($current{$rule})) { |
|
if ($newvalues{$rule} ne $current{$rule}) { |
|
$changes{'rules'} = 1; |
|
} |
|
} elsif ($rule eq 'min') { |
|
if ($staticdefaults{$rule} ne $newvalues{$rule}) { |
|
$changes{'rules'} = 1; |
|
} |
|
} |
|
} elsif (exists($current{$rule})) { |
|
$changes{'rules'} = 1; |
|
} |
|
} |
|
my @posschars = &Apache::loncommon::get_env_multiple('form.passwords_chars'); |
|
my @chars; |
|
foreach my $item (sort(@posschars)) { |
|
if ($item =~ /^(uc|lc|num|spec)$/) { |
|
push(@chars,$item); |
|
} |
|
} |
|
$newvalues{'chars'} = \@chars; |
|
unless ($changes{'rules'}) { |
|
if (ref($current{'chars'}) eq 'ARRAY') { |
|
my @diffs = &Apache::loncommon::compare_arrays($current{'chars'},\@chars); |
|
if (@diffs > 0) { |
|
$changes{'rules'} = 1; |
|
} |
|
} else { |
|
if (@chars > 0) { |
|
$changes{'rules'} = 1; |
|
} |
|
} |
|
} |
|
if ($env{'form.passwords_crsowner'}) { |
|
$newvalues{'crsownerchg'} = 1; |
|
unless ($current{'crsownerchg'}) { |
|
$changes{'crsownerchg'} = 1; |
|
} |
|
} elsif ($current{'crsownerchg'}) { |
|
$changes{'crsownerchg'} = 1; |
|
} |
|
|
|
my %confighash = ( |
|
defaults => \%save_defaults, |
|
passwords => \%newvalues, |
|
); |
|
&process_captcha('passwords',\%changes,$confighash{'passwords'},$domconfig{'passwords'}); |
|
|
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%confighash,$dom); |
|
if ($putresult eq 'ok') { |
|
if (keys(%changes) > 0) { |
|
$resulttext = &mt('Changes made: ').'<ul>'; |
|
foreach my $key ('reset','intauth','rules','crsownerchg') { |
|
if ($changes{$key}) { |
|
unless ($key eq 'intauth') { |
|
$updateconf = 1; |
|
} |
|
$resulttext .= '<li>'.$titles{$key}.':<ul>'; |
|
if ($key eq 'reset') { |
|
if ($confighash{'passwords'}{'captcha'} eq 'original') { |
|
$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>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('No CAPTCHA validation').'</li>'; |
|
} |
|
if ($confighash{'passwords'}{'resetlink'}) { |
|
$resulttext .= '<li>'.&mt('Reset link expiration set to [quant,_1,hour]',$confighash{'passwords'}{'resetlink'}).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('No reset link expiration set.').' '. |
|
&mt('Will default to 2 hours').'</li>'; |
|
} |
|
if (ref($confighash{'passwords'}{'resetcase'}) eq 'ARRAY') { |
|
if (@{$confighash{'passwords'}{'resetcase'}} == 0) { |
|
$resulttext .= '<li>'.&mt('User input for username and/or e-mail address not case sensitive for "Forgot Password" web form').'</li>'; |
|
} else { |
|
my $casesens; |
|
foreach my $type (@{$confighash{'passwords'}{'resetcase'}}) { |
|
if ($type eq 'default') { |
|
$casesens .= $othertitle.', '; |
|
} elsif ($usertypes->{$type} ne '') { |
|
$casesens .= $usertypes->{$type}.', '; |
|
} |
|
} |
|
$casesens =~ s/\Q, \E$//; |
|
$resulttext .= '<li>'.&mt('"Forgot Password" web form input for username and/or e-mail address is case-sensitive for: [_1]',$casesens).'</li>'; |
|
} |
|
} else { |
|
$resulttext .= '<li>'.&mt('Case-sensitivity not set for "Forgot Password" web form').' '.&mt('Will default to case-sensitive for username and/or e-mail address for all').'</li>'; |
|
} |
|
if ($confighash{'passwords'}{'resetprelink'} eq 'either') { |
|
$resulttext .= '<li>'.&mt('Users can enter either a username or an e-mail address in "Forgot Password" web form').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Users can enter both a username and an e-mail address in "Forgot Password" web form').'</li>'; |
|
} |
|
if (ref($confighash{'passwords'}{'resetpostlink'}) eq 'HASH') { |
|
my $output; |
|
if (ref($types) eq 'ARRAY') { |
|
foreach my $type (@{$types}) { |
|
if (ref($confighash{'passwords'}{'resetpostlink'}{$type}) eq 'ARRAY') { |
|
if (@{$confighash{'passwords'}{'resetpostlink'}{$type}} == 0) { |
|
$output .= $usertypes->{$type}.' -- '.&mt('none'); |
|
} else { |
|
$output .= $usertypes->{$type}.' -- '. |
|
join(', ',map { $titles{$_}; } (@{$confighash{'passwords'}{'resetpostlink'}{$type}})).'; '; |
|
} |
|
} |
|
} |
|
} |
|
if (ref($confighash{'passwords'}{'resetpostlink'}{'default'}) eq 'ARRAY') { |
|
if (@{$confighash{'passwords'}{'resetpostlink'}{'default'}} == 0) { |
|
$output .= $othertitle.' -- '.&mt('none'); |
|
} else { |
|
$output .= $othertitle.' -- '. |
|
join(', ',map { $titles{$_}; } (@{$confighash{'passwords'}{'resetpostlink'}{'default'}})); |
|
} |
|
} |
|
if ($output) { |
|
$resulttext .= '<li>'.&mt('Information required for new password form (by user type) set to: [_1]',$output).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Information required for new password form not set.').' '.&mt('Will default to requiring both the username and an e-mail address').'</li>'; |
|
} |
|
} else { |
|
$resulttext .= '<li>'.&mt('Information required for new password form not set.').' '.&mt('Will default to requiring both the username and an e-mail address').'</li>'; |
|
} |
|
if (ref($confighash{'passwords'}{'resetemail'}) eq 'ARRAY') { |
|
if (@{$confighash{'passwords'}{'resetemail'}} > 0) { |
|
$resulttext .= '<li>'.&mt('E-mail address(es) in LON-CAPA used for verification will include: [_1]',join(', ',map { $titles{$_}; } @{$confighash{'passwords'}{'resetemail'}})).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('E-mail address(es) in LON-CAPA used for verification will include: [_1]',join(', ',map { $titles{$_}; } @{$staticdefaults{'resetemail'}})).'</li>'; |
|
} |
|
} else { |
|
$resulttext .= '<li>'.&mt('E-mail address(es) in LON-CAPA usedfor verification will include: [_1]',join(', ',map { $titles{$_}; } @{$staticdefaults{'resetemail'}})).'</li>'; |
|
} |
|
if ($confighash{'passwords'}{'resetremove'}) { |
|
$resulttext .= '<li>'.&mt('Preamble to "Forgot Password" web form not shown').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Preamble to "Forgot Password" web form is shown').'</li>'; |
|
} |
|
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>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('No custom text included in preamble to "Forgot Password" form').'</li>'; |
|
} |
|
} elsif ($key eq 'intauth') { |
|
foreach my $item ('cost','switch','check') { |
|
my $value = $save_defaults{$key.'_'.$item}; |
|
if ($item eq 'switch') { |
|
my %optiondesc = &Apache::lonlocal::texthash ( |
|
0 => 'No', |
|
1 => 'Yes', |
|
2 => 'Yes, and copy existing passwd file to passwd.bak file', |
|
); |
|
if ($value =~ /^(0|1|2)$/) { |
|
$value = $optiondesc{$value}; |
|
} else { |
|
$value = &mt('none -- defaults to No'); |
|
} |
|
} elsif ($item eq 'check') { |
|
my %optiondesc = &Apache::lonlocal::texthash ( |
|
0 => 'No', |
|
1 => 'Yes, allow login then update passwd file using default cost (if higher)', |
|
2 => 'Yes, disallow login if stored cost is less than domain default', |
|
); |
|
if ($value =~ /^(0|1|2)$/) { |
|
$value = $optiondesc{$value}; |
|
} else { |
|
$value = &mt('none -- defaults to No'); |
|
} |
|
} |
|
$resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$titles{$key.'_'.$item},$value).'</li>'; |
|
} |
|
} elsif ($key eq 'rules') { |
|
foreach my $rule ('min','max','expire','numsaved') { |
|
if ($confighash{'passwords'}{$rule} eq '') { |
|
if ($rule eq 'min') { |
|
$resulttext .= '<li>'.&mt('[_1] not set.',$titles{$rule}); |
|
' '.&mt('Default of 7 will be used').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('[_1] set to none',$titles{$rule}).'</li>'; |
|
} |
|
} else { |
|
$resulttext .= '<li>'.&mt('[_1] set to [_2]',$titles{$rule},$confighash{'passwords'}{$rule}).'</li>'; |
|
} |
|
} |
|
} elsif ($key eq 'crsownerchg') { |
|
if ($confighash{'passwords'}{'crsownerchg'}) { |
|
$resulttext .= '<li>'.&mt('Course owner may change student passwords.').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Course owner may not change student passwords.'); |
|
} |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
|
} |
|
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = &mt('No changes made to password settings'); |
|
} |
|
my $cachetime = 24*60*60; |
|
if ($updatedefaults) { |
|
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
|
if (ref($lastactref) eq 'HASH') { |
|
$lastactref->{'domdefaults'} = 1; |
|
} |
|
} |
|
if ($updateconf) { |
|
&Apache::lonnet::do_cache_new('passwdconf',$dom,$confighash{'passwords'},$cachetime); |
|
if (ref($lastactref) eq 'HASH') { |
|
$lastactref->{'passwdconf'} = 1; |
|
} |
|
} |
|
} else { |
|
$resulttext = '<span class="LC_error">'. |
|
&mt('An error occurred: [_1]',$putresult).'</span>'; |
|
} |
|
if ($errors) { |
|
$resulttext .= '<p>'.&mt('The following errors occurred: ').'<ul>'. |
|
$errors.'</ul></p>'; |
|
} |
|
return $resulttext; |
|
} |
|
|
sub modify_usercreation { |
sub modify_usercreation { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,%curr_usercreation,%changes,%authallowed,%cancreate,%save_usercreate); |
my ($resulttext,%curr_usercreation,%changes,%authallowed,%cancreate,%save_usercreate); |
Line 14836 sub modify_defaults {
|
Line 15708 sub modify_defaults {
|
my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors); |
my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def', |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def', |
'portal_def','intauth_cost','intauth_check','intauth_switch'); |
'portal_def'); |
my @authtypes = ('internal','krb4','krb5','localauth','lti'); |
my @authtypes = ('internal','krb4','krb5','localauth','lti'); |
foreach my $item (@items) { |
foreach my $item (@items) { |
$newvalues{$item} = $env{'form.'.$item}; |
$newvalues{$item} = $env{'form.'.$item}; |
Line 14878 sub modify_defaults {
|
Line 15750 sub modify_defaults {
|
push(@errors,$item); |
push(@errors,$item); |
} |
} |
} |
} |
} elsif ($item eq 'intauth_cost') { |
|
if ($newvalues{$item} ne '') { |
|
if ($newvalues{$item} =~ /\D/) { |
|
push(@errors,$item); |
|
} |
|
} |
|
} elsif ($item eq 'intauth_check') { |
|
if ($newvalues{$item} ne '') { |
|
unless ($newvalues{$item} =~ /^(0|1|2)$/) { |
|
push(@errors,$item); |
|
} |
|
} |
|
} elsif ($item eq 'intauth_switch') { |
|
if ($newvalues{$item} ne '') { |
|
unless ($newvalues{$item} =~ /^(0|1|2)$/) { |
|
push(@errors,$item); |
|
} |
|
} |
|
} |
} |
if (grep(/^\Q$item\E$/,@errors)) { |
if (grep(/^\Q$item\E$/,@errors)) { |
$newvalues{$item} = $domdefaults{$item}; |
$newvalues{$item} = $domdefaults{$item}; |
Line 14904 sub modify_defaults {
|
Line 15758 sub modify_defaults {
|
} |
} |
$domdefaults{$item} = $newvalues{$item}; |
$domdefaults{$item} = $newvalues{$item}; |
} |
} |
|
my %staticdefaults = ( |
|
'intauth_cost' => 10, |
|
'intauth_check' => 0, |
|
'intauth_switch' => 0, |
|
); |
|
foreach my $item ('intauth_cost','intauth_check','intauth_switch') { |
|
if (exists($domdefaults{$item})) { |
|
$newvalues{$item} = $domdefaults{$item}; |
|
} else { |
|
$newvalues{$item} = $staticdefaults{$item}; |
|
} |
|
} |
my %defaults_hash = ( |
my %defaults_hash = ( |
defaults => \%newvalues, |
defaults => \%newvalues, |
); |
); |
Line 15032 sub modify_defaults {
|
Line 15898 sub modify_defaults {
|
lti => 'lti', |
lti => 'lti', |
); |
); |
$value = $authnames{$shortauth{$value}}; |
$value = $authnames{$shortauth{$value}}; |
} elsif ($item eq 'intauth_switch') { |
|
my %optiondesc = &Apache::lonlocal::texthash ( |
|
0 => 'No', |
|
1 => 'Yes', |
|
2 => 'Yes, and copy existing passwd file to passwd.bak file', |
|
); |
|
if ($value =~ /^(0|1|2)$/) { |
|
$value = $optiondesc{$value}; |
|
} else { |
|
$value = &mt('none -- defaults to No'); |
|
} |
|
} elsif ($item eq 'intauth_check') { |
|
my %optiondesc = &Apache::lonlocal::texthash ( |
|
0 => 'No', |
|
1 => 'Yes, allow login then update passwd file using default cost (if higher)', |
|
2 => 'Yes, disallow login if stored cost is less than domain default', |
|
); |
|
if ($value =~ /^(0|1|2)$/) { |
|
$value = $optiondesc{$value}; |
|
} else { |
|
$value = &mt('none -- defaults to No'); |
|
} |
|
} |
} |
$resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$title->{$item},$value).'</li>'; |
$resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$title->{$item},$value).'</li>'; |
$mailmsgtext .= "$title->{$item} set to $value\n"; |
$mailmsgtext .= "$title->{$item} set to $value\n"; |
Line 15137 sub modify_scantron {
|
Line 15981 sub modify_scantron {
|
if ($env{'form.scantronformat_del'}) { |
if ($env{'form.scantronformat_del'}) { |
$confhash{'scantron'}{'scantronformat'} = ''; |
$confhash{'scantron'}{'scantronformat'} = ''; |
$changes{'scantronformat'} = 1; |
$changes{'scantronformat'} = 1; |
|
} else { |
|
$confhash{'scantron'}{'scantronformat'} = $domconfig{'scantron'}{'scantronformat'}; |
} |
} |
} |
} |
} |
} |
|
my @options = ('hdr','pad','rem'); |
my @fields = &scantroncsv_fields(); |
my @fields = &scantroncsv_fields(); |
my %titles = &scantronconfig_titles(); |
my %titles = &scantronconfig_titles(); |
my @formats = &Apache::loncommon::get_env_multiple('form.scantronformat'); |
my @formats = &Apache::loncommon::get_env_multiple('form.scantronconfig'); |
my ($newdat,$currdat,%newcol,%currcol); |
my ($newdat,$currdat,%newcol,%currcol); |
if (grep(/^dat$/,@formats)) { |
if (grep(/^dat$/,@formats)) { |
$confhash{'scantron'}{config}{dat} = 1; |
$confhash{'scantron'}{config}{dat} = 1; |
$newdat = 1; |
$newdat = 1; |
} else { |
} else { |
$confhash{'scantron'}{config}{dat} = 0; |
|
$newdat = 0; |
$newdat = 0; |
} |
} |
if (grep(/^csv$/,@formats)) { |
if (grep(/^csv$/,@formats)) { |
Line 15157 sub modify_scantron {
|
Line 16003 sub modify_scantron {
|
if ($env{'form.scantronconfig_csv_'.$field} =~ /^(\d+)$/) { |
if ($env{'form.scantronconfig_csv_'.$field} =~ /^(\d+)$/) { |
my $posscol = $1; |
my $posscol = $1; |
if (($posscol < 20) && (!$bynum{$posscol})) { |
if (($posscol < 20) && (!$bynum{$posscol})) { |
$confhash{'scantron'}{config}{csv}{$field} = $posscol; |
$confhash{'scantron'}{config}{csv}{fields}{$field} = $posscol; |
$bynum{$posscol} = $field; |
$bynum{$posscol} = $field; |
$newcol{$field} = $posscol; |
$newcol{$field} = $posscol; |
} |
} |
} |
} |
} |
} |
|
if (keys(%newcol)) { |
|
foreach my $option (@options) { |
|
if ($env{'form.scantroncsv_'.$option}) { |
|
$confhash{'scantron'}{config}{csv}{options}{$option} = 1; |
|
} |
|
} |
|
} |
} |
} |
$currdat = 1; |
$currdat = 1; |
if (ref($domconfig{'scantron'}) eq 'HASH') { |
if (ref($domconfig{'scantron'}) eq 'HASH') { |
if (ref($domconfig{'scantron'}{'config'}) eq 'HASH') { |
if (ref($domconfig{'scantron'}{'config'}) eq 'HASH') { |
if (!$domconfig{'scantron'}{'config'}{'dat'}) { |
unless (exists($domconfig{'scantron'}{'config'}{'dat'})) { |
$currdat = 0; |
$currdat = 0; |
} |
} |
if (ref($domconfig{'scantron'}{'config'}{'csv'}) eq 'HASH') { |
if (ref($domconfig{'scantron'}{'config'}{'csv'}) eq 'HASH') { |
%currcol = %{$domconfig{'scantron'}{'config'}{'csv'}}; |
if (ref($domconfig{'scantron'}{'config'}{'csv'}{'fields'}) eq 'HASH') { |
|
%currcol = %{$domconfig{'scantron'}{'config'}{'csv'}{'fields'}}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 15183 sub modify_scantron {
|
Line 16038 sub modify_scantron {
|
if ($currcol{$field} ne $newcol{$field}) { |
if ($currcol{$field} ne $newcol{$field}) { |
$changes{'config'} = 1; |
$changes{'config'} = 1; |
last; |
last; |
} |
} |
} elsif ($newcol{$field} ne '') { |
} elsif ($newcol{$field} ne '') { |
$changes{'config'} = 1; |
$changes{'config'} = 1; |
last; |
last; |
Line 15204 sub modify_scantron {
|
Line 16059 sub modify_scantron {
|
$resulttext .= '<li>'.&mt('Custom bubblesheet format file ([_1]) uploaded for use with courses in this domain.',$custom).'</li>'; |
$resulttext .= '<li>'.&mt('Custom bubblesheet format file ([_1]) uploaded for use with courses in this domain.',$custom).'</li>'; |
} |
} |
} |
} |
if ($changes{'config'}) { |
if ($changes{'config'}) { |
if (ref($confhash{'scantron'}{'config'}) eq 'HASH') { |
if (ref($confhash{'scantron'}{'config'}) eq 'HASH') { |
if ($confhash{'scantron'}{'config'}{'dat'}) { |
if ($confhash{'scantron'}{'config'}{'dat'}) { |
$resulttext .= '<li>'.&mt('Bubblesheet data upload formats includes .dat format').'</li>'; |
$resulttext .= '<li>'.&mt('Bubblesheet data upload formats includes .dat format').'</li>'; |
} |
} |
if (ref($confhash{'scantron'}{'config'}{'csv'}) eq 'HASH') { |
if (ref($confhash{'scantron'}{'config'}{'csv'}) eq 'HASH') { |
if (keys(%{$confhash{'scantron'}{'config'}{'csv'}})) { |
if (ref($confhash{'scantron'}{'config'}{'csv'}{'fields'}) eq 'HASH') { |
'<li>'.&mt('Bubblesheet data upload formats includes .csv format, with following fields/column numbers supported:').'<ul>'; |
if (keys(%{$confhash{'scantron'}{'config'}{'csv'}{'fields'}})) { |
foreach my $field (@fields) { |
$resulttext .= '<li>'.&mt('Bubblesheet data upload formats includes .csv format, with following fields/column numbers supported:').'<ul>'; |
if ($confhash{'scantron'}{'config'}{'csv'}{$field} ne '') { |
foreach my $field (@fields) { |
my $showcol = $confhash{'scantron'}{'config'}{'csv'}{$field} + 1; |
if ($confhash{'scantron'}{'config'}{'csv'}{'fields'}{$field} ne '') { |
$resulttext .= '<li>'.$titles{$field}.': '.$showcol.'</li>'; |
my $showcol = $confhash{'scantron'}{'config'}{'csv'}{'fields'}{$field} + 1; |
|
$resulttext .= '<li>'.$titles{$field}.': '.$showcol.'</li>'; |
|
} |
|
} |
|
$resulttext .= '</ul></li>'; |
|
if (ref($confhash{'scantron'}{'config'}{'csv'}{'options'}) eq 'HASH') { |
|
if (keys(%{$confhash{'scantron'}{'config'}{'csv'}{'options'}})) { |
|
$resulttext .= '<li>'.&mt('Bubblesheet data upload formats includes .csv format, with following options:').'<ul>'; |
|
foreach my $option (@options) { |
|
if ($confhash{'scantron'}{'config'}{'csv'}{'options'}{$option} ne '') { |
|
$resulttext .= '<li>'.$titles{$option}.'</li>'; |
|
} |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
} |
} |
} |
} |
$resulttext .= '</ul></li>'; |
|
} |
} |
} |
} |
} else { |
} else { |
Line 15244 sub modify_scantron {
|
Line 16112 sub modify_scantron {
|
$resulttext = &mt('No changes made to bubblesheet format file'); |
$resulttext = &mt('No changes made to bubblesheet format file'); |
} |
} |
if ($errors) { |
if ($errors) { |
$resulttext .= &mt('The following errors occurred: ').'<ul>'. |
$resulttext .= '<p>'.&mt('The following errors occurred: ').'<ul>'. |
$errors.'</ul>'; |
$errors.'</ul></p>'; |
} |
} |
return $resulttext; |
return $resulttext; |
} |
} |
Line 16066 sub modify_coursedefaults {
|
Line 16934 sub modify_coursedefaults {
|
$defaultshash{'coursedefaults'}{$setting}{$type} = $newdef; |
$defaultshash{'coursedefaults'}{$setting}{$type} = $newdef; |
} |
} |
if ($currdef ne $newdef) { |
if ($currdef ne $newdef) { |
my $staticdef; |
|
if ($item eq 'anonsurvey_threshold') { |
if ($item eq 'anonsurvey_threshold') { |
unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) { |
unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) { |
$changes{$item} = 1; |
$changes{$item} = 1; |
Line 16082 sub modify_coursedefaults {
|
Line 16949 sub modify_coursedefaults {
|
my $texengine; |
my $texengine; |
if ($env{'form.texengine'} =~ /^(MathJax|mimetex|tth)$/) { |
if ($env{'form.texengine'} =~ /^(MathJax|mimetex|tth)$/) { |
$texengine = $env{'form.texengine'}; |
$texengine = $env{'form.texengine'}; |
if ($defaultshash{'coursedefaults'}{'texengine'} eq '') { |
my $currdef = $domconfig{'coursedefaults'}{'texengine'}; |
unless ($texengine eq 'MathJax') { |
if ($currdef eq '') { |
|
unless ($texengine eq $Apache::lonnet::deftex) { |
$changes{'texengine'} = 1; |
$changes{'texengine'} = 1; |
} |
} |
} elsif ($defaultshash{'coursedefaults'}{'texengine'} ne $texengine) { |
} elsif ($currdef ne $texengine) { |
$changes{'texengine'} = 1; |
$changes{'texengine'} = 1; |
} |
} |
} |
} |
Line 18299 sub devalidate_remote_domconfs {
|
Line 19167 sub devalidate_remote_domconfs {
|
my %servers = &Apache::lonnet::internet_dom_servers($dom); |
my %servers = &Apache::lonnet::internet_dom_servers($dom); |
my %thismachine; |
my %thismachine; |
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
my @posscached = ('domainconfig','domdefaults','ltitools','usersessions','directorysrch'); |
my @posscached = ('domainconfig','domdefaults','ltitools','usersessions', |
|
'directorysrch','passwdconf'); |
if (keys(%servers)) { |
if (keys(%servers)) { |
foreach my $server (keys(%servers)) { |
foreach my $server (keys(%servers)) { |
next if ($thismachine{$server}); |
next if ($thismachine{$server}); |