version 1.50, 2017/06/18 22:29:01
|
version 1.56, 2021/10/08 18:49:17
|
Line 25
|
Line 25
|
# |
# |
package LONCAPA::Enrollment; |
package LONCAPA::Enrollment; |
|
|
|
use lib '/home/httpd/lib/perl'; |
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonmsg; |
use Apache::lonmsg; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use HTML::Entities; |
use HTML::Entities; |
|
use HTML::Parser; |
use LONCAPA::Configuration; |
use LONCAPA::Configuration; |
|
use Math::Random; |
use Time::Local; |
use Time::Local; |
use lib '/home/httpd/lib/perl'; |
|
|
|
use strict; |
use strict; |
|
|
Line 329 sub update_LC {
|
Line 331 sub update_LC {
|
} |
} |
} |
} |
# Check for institutional section change |
# Check for institutional section change |
if ($$currlist{$uname}[$instidx] ne $instsec) { |
if (($$currlist{$uname}[$instidx] ne $instsec) && (!$added) && ($$currlist{$uname}[$type] eq "auto")) { |
my $modify_instsec_result = |
my $modify_instsec_result = |
&Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid,'',$context,$credits,$instsec); |
&Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid,'',$context,$credits,$instsec); |
if ($modify_instsec_result =~ /^ok/) { |
if ($modify_instsec_result =~ /^ok/) { |
Line 443 sub update_LC {
|
Line 445 sub update_LC {
|
# Check for changed usernames by checking studentIDs |
# Check for changed usernames by checking studentIDs |
if (grep/^$$currlist{$uname}[ $stuid ]$/,@allINids) { |
if (grep/^$$currlist{$uname}[ $stuid ]$/,@allINids) { |
foreach my $match (@{$unameFromINid{$$currlist{$uname}[ $stuid ]}} ) { |
foreach my $match (@{$unameFromINid{$$currlist{$uname}[ $stuid ]}} ) { |
$$logmsg .= &mt('A possible change in username has been detected for a student enrolled in this course.').' '.&mt('The existing LON-CAPA classlist contains user: [_1] and student/employee ID: [_2].',$uname,$$currlist{$uname}[ $place{studentID} ]).' '.&mt('This username has been dropped from the institutional classlist, but the same student/employee ID is used for user: [_1] who still appears in the institutional classlist.',$match).' '.&mt('You may need to move the student data files for user: [_1] to [_2]',$uname,$match).' '.&mt('Because of this, user [_1] has not been dropped from the course.',$uname).$linefeed; |
$$logmsg .= &mt('A possible change in username has been detected for a student enrolled in this course.').' '.&mt('The existing LON-CAPA classlist contains user: [_1] and student/employee ID: [_2].',$uname,$$currlist{$uname}[ $stuid ]).' '.&mt('This username has been dropped from the institutional classlist, but the same student/employee ID is used for user: [_1] who still appears in the institutional classlist.',$match).' '.&mt('You may need to move the student data files for user: [_1] to [_2]',$uname,$match).' '.&mt('Because of this, user [_1] has not been dropped from the course.',$uname).$linefeed; |
push @saved,$uname; |
push @saved,$uname; |
} |
} |
} elsif (@saved == 0) { |
} elsif (@saved == 0) { |
Line 586 sub create_newuser {
|
Line 588 sub create_newuser {
|
# If no account exists and passwords should be generated |
# If no account exists and passwords should be generated |
if ($auth eq "internal") { |
if ($auth eq "internal") { |
if ($authparam eq '') { |
if ($authparam eq '') { |
$authparam = &create_password(); |
$authparam = &create_password($udom); |
if ($authparam eq '') { |
if ($authparam eq '') { |
$authchk = ''; |
$authchk = ''; |
} else { |
} else { |
Line 950 sub process_date {
|
Line 952 sub process_date {
|
} |
} |
|
|
sub create_password { |
sub create_password { |
my $passwd = ''; |
my ($udom) = @_; |
my @letts = ("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"); |
my %passwdconf = &Apache::lonnet::get_passwdconf($udom); |
for (my $i=0; $i<8; $i++) { |
my ($min,$max,@chars); |
|
$min = $Apache::lonnet::passwdmin; |
|
if (ref($passwdconf{'chars'}) eq 'ARRAY') { |
|
if ($passwdconf{'min'} =~ /^\d+$/) { |
|
if ($passwdconf{'min'} > $min) { |
|
$min = $passwdconf{'min'}; |
|
} |
|
} |
|
if ($passwdconf{'max'} =~ /^\d+$/) { |
|
$max = $passwdconf{'max'}; |
|
} |
|
@chars = @{$passwdconf{'chars'}}; |
|
} |
|
my @letts = qw(b c d f g h j k l m n p q r s t v w x y z); |
|
my (@included,%reqd); |
|
if (@chars) { |
|
map { $reqd{$_} = 1; } @chars; |
|
} |
|
if ($reqd{'uc'}) { |
|
my $letter = $letts[int( rand(21) )]; |
|
$letter =~ tr/a-z/A-Z/; |
|
if ($letter ne '') { |
|
push(@included,$letter); |
|
} |
|
} |
|
if ($reqd{'lc'}) { |
|
my $letter = $letts[int( rand(21) )]; |
|
if ($letter ne '') { |
|
push(@included,$letter); |
|
} |
|
} |
|
if ($reqd{'num'}) { |
|
my $number = int( rand(10) ); |
|
if ($number ne '') { |
|
push(@included,$number); |
|
} |
|
} |
|
if ($reqd{'spec'}) { |
|
my @specs = qw(! # * & _ - + $); |
|
my $special = $specs[int( rand(8) )]; |
|
if ($special ne '') { |
|
push(@included,$special); |
|
} |
|
} |
|
my $start = 0; |
|
if (scalar(@included) > 0) { |
|
$start = scalar(@included); |
|
} |
|
my $end = 8; |
|
if ($min =~ /^\d+$/) { |
|
if ($min > $end) { |
|
$end = $min; |
|
} |
|
} |
|
for (my $i=$start; $i<$end; $i++) { |
my $lettnum = int (rand 2); |
my $lettnum = int (rand 2); |
my $item = ''; |
my $item = ''; |
if ($lettnum) { |
if ($lettnum) { |
$item = $letts[int( rand(26) )]; |
$item = $letts[int( rand(21) )]; |
my $uppercase = int(rand 2); |
my $uppercase = int(rand 2); |
if ($uppercase) { |
if ($uppercase) { |
$item =~ tr/a-z/A-Z/; |
$item =~ tr/a-z/A-Z/; |
} |
} |
} else { |
} else { |
$item = int( rand(10) ); |
$item = int( rand(10) ); |
} |
} |
$passwd .= $item; |
if ($item ne '') { |
|
push(@included,$item); |
|
} |
} |
} |
return ($passwd); |
my $passwd = join('',&Math::Random::random_permutation(@included)); |
|
return $passwd; |
} |
} |
|
|
sub get_courseinfo { |
sub get_courseinfo { |