--- loncom/interface/lonuserutils.pm 2017/11/04 20:23:23 1.192 +++ loncom/interface/lonuserutils.pm 2017/11/04 20:59:39 1.193 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.192 2017/11/04 20:23:23 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.193 2017/11/04 20:59:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1132,6 +1132,11 @@ sub print_upload_manager_form { &Apache::loncommon::load_tmp_file($r,$datatoken); } } + if ($datatoken eq '') { + $r->print('

'.&mt('Error').': '. + &mt('Invalid datatoken').'

'); + return 'missingdata'; + } my @records=&Apache::loncommon::upfile_record_sep(); if($env{'form.noFirstLine'}){ $firstLine=shift(@records); @@ -1214,6 +1219,7 @@ sub print_upload_manager_form { } &print_upload_manager_footer($r,$i,$keyfields,$defdom,$today,$halfyear, $context,$permission,$crstype,$showcredits); + return 'ok'; } sub setup_date_selectors { @@ -4179,7 +4185,7 @@ sub upfile_drop_add { $r->print(''.&mt('Error').': '. &mt('Enrollment of users not permitted for specified default domain: [_1].', &Apache::lonnet::domain($env{'form.defaultdomain'},'description')).''); - return; + return 'untrusted'; } } } elsif ($context eq 'author') { @@ -4193,7 +4199,7 @@ sub upfile_drop_add { $r->print(''.&mt('Error').': '. &mt('Addition of users not permitted for specified default domain: [_1].', &Apache::lonnet::domain($env{'form.defaultdomain'},'description')).''); - return; + return 'untrusted'; } } } elsif (($context eq 'domain') && ($setting eq 'domain')) { @@ -4206,7 +4212,7 @@ sub upfile_drop_add { $r->print(''.&mt('Error').': '. &mt('Addition of users not permitted for specified default domain: [_1].', &Apache::lonnet::domain($env{'form.defaultdomain'},'description')).''); - return; + return 'untrusted'; } } } @@ -4219,9 +4225,9 @@ sub upfile_drop_add { } else { my %home_servers = &Apache::lonnet::get_servers($defdom,'library'); if (! exists($home_servers{$desiredhost})) { - $r->print(''.&mt('Error').': '. - &mt('Invalid home server specified').''); - return; + $r->print('

'.&mt('Error').': '. + &mt('Invalid home server specified').'

'); + return 'invalidhome'; } } # Determine authentication mechanism @@ -4248,7 +4254,7 @@ sub upfile_drop_add { } if ($amode =~ /^krb/) { if (! defined($genpwd) || $genpwd eq '') { - $r->print(''.': '. + $r->print(''. &mt('Unable to enroll users').' '. &mt('No Kerberos domain was specified.').'

'); $amode = ''; # This causes the loop below to be skipped @@ -4321,6 +4327,11 @@ sub upfile_drop_add { } } } + if ($datatoken eq '') { + $r->print('

'.&mt('Error').': '. + &mt('Invalid datatoken').'

'); + return 'missingdata'; + } if ( $domain eq &LONCAPA::clean_domain($domain) && ($amode ne '')) { ####################################### @@ -4934,6 +4945,7 @@ sub upfile_drop_add { } } } # end of unless + return 'ok'; } sub print_namespacing_alerts {