--- loncom/auth/lonauth.pm 2000/01/14 21:12:40 1.4 +++ loncom/auth/lonauth.pm 2000/02/29 16:24:00 1.5 @@ -2,7 +2,7 @@ # User Authentication Module # 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, -# 1/14 Gerd Kortemeyer +# 1/14,2/24,2/28,2/29 Gerd Kortemeyer package Apache::lonauth; @@ -26,33 +26,16 @@ sub success { # Give them a new cookie - my $now=time; - $cookie="$username\_$now\_$domain\_$authhost"; - my $rolesdump=Apache::lonnet::reply("dump:$domain:$username:roles", - $authhost); - my $userroles=''; - if ($rolesdump ne '') { - map { - my ($area,$role)=split(/=/,$_); - 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 $now=time; + $cookie="$username\_$now\_$domain\_$authhost"; + +# Initialize roles + + my $userroles=Apache::lonnet::rolesinit($domain,$username,$authhost); + +# Write first profile + + { my $idf=Apache::File->new(">$lonids/$cookie.id"); print $idf "user.name=$username\n"; print $idf "user.domain=$domain\n"; @@ -60,7 +43,12 @@ sub success { if ($userroles ne '') { print $idf "$userroles" }; } +# ------------------------------------------------------------ Get cookie ready + $cookie="lonID=$cookie; path=/"; + +# ------------------------------------------------- Output for successful login + $r->send_cgi_header(<