version 1.4, 2000/01/14 21:12:40
|
version 1.5, 2000/02/29 16:24:00
|
Line 2
|
Line 2
|
# User Authentication Module |
# User Authentication Module |
# 5/21/99,5/22,5/25,5/26,5/27,5/29,6/2,6/11,6/14,6/15 |
# 5/21/99,5/22,5/25,5/26,5/27,5/29,6/2,6/11,6/14,6/15 |
# 16/11,12/16, |
# 16/11,12/16, |
# 1/14 Gerd Kortemeyer |
# 1/14,2/24,2/28,2/29 Gerd Kortemeyer |
|
|
package Apache::lonauth; |
package Apache::lonauth; |
|
|
Line 26 sub success {
|
Line 26 sub success {
|
|
|
# Give them a new cookie |
# Give them a new cookie |
|
|
my $now=time; |
my $now=time; |
$cookie="$username\_$now\_$domain\_$authhost"; |
$cookie="$username\_$now\_$domain\_$authhost"; |
my $rolesdump=Apache::lonnet::reply("dump:$domain:$username:roles", |
|
$authhost); |
# Initialize roles |
my $userroles=''; |
|
if ($rolesdump ne '') { |
my $userroles=Apache::lonnet::rolesinit($domain,$username,$authhost); |
map { |
|
my ($area,$role)=split(/=/,$_); |
# Write first profile |
my ($trole,$tend,$tstart)=split(/_/,$role); |
|
if ($tend!=0) { |
{ |
if ($tend<$now) { |
|
my $localtime=localtime($tend); |
|
$trole="Role expired $localtime"; |
|
} |
|
} |
|
if ($tstart!=0) { |
|
if ($tstart>$now) { |
|
my $localtime=localtime($tend); |
|
$trole="Role becomes active $localtime"; |
|
} |
|
} |
|
if ($area ne '') { |
|
$userroles.="user.role.$area=$trole\n"; |
|
} |
|
} split(/&/,$rolesdump); |
|
} |
|
{ |
|
my $idf=Apache::File->new(">$lonids/$cookie.id"); |
my $idf=Apache::File->new(">$lonids/$cookie.id"); |
print $idf "user.name=$username\n"; |
print $idf "user.name=$username\n"; |
print $idf "user.domain=$domain\n"; |
print $idf "user.domain=$domain\n"; |
Line 60 sub success {
|
Line 43 sub success {
|
if ($userroles ne '') { print $idf "$userroles" }; |
if ($userroles ne '') { print $idf "$userroles" }; |
} |
} |
|
|
|
# ------------------------------------------------------------ Get cookie ready |
|
|
$cookie="lonID=$cookie; path=/"; |
$cookie="lonID=$cookie; path=/"; |
|
|
|
# ------------------------------------------------- Output for successful login |
|
|
$r->send_cgi_header(<<ENDHEADER); |
$r->send_cgi_header(<<ENDHEADER); |
Content-type: text/html |
Content-type: text/html |
Set-cookie: $cookie |
Set-cookie: $cookie |