--- loncom/auth/lonauth.pm 1999/12/16 20:30:55 1.3 +++ loncom/auth/lonauth.pm 2000/02/29 16:24:00 1.5 @@ -1,7 +1,8 @@ # The LearningOnline Network # 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 Gerd Kortemeyer +# 16/11,12/16, +# 1/14,2/24,2/28,2/29 Gerd Kortemeyer package Apache::lonauth; @@ -14,29 +15,40 @@ use Apache::lonnet(); # ------------------------------------------------------------ Successful login sub success { - my ($r, $lowerurl, $username, $domain, $authhost) = @_; + my ($r, $username, $domain, $authhost) = @_; my $lonids=$r->dir_config('lonIDsDir'); -# See if old ID present, but overlooked + +# See if old ID present, if so, remove my $cookie; - if ($cookie=<$lonids/$username\_*\_$domain\_$authhost.id>) { - $cookie=~s/\.id//; - $cookie=~s/$lonids\///; - } else { - my $now=time; - $cookie="$username\_$now\_$domain\_$authhost"; - my $userroles=Apache::lonnet::reply( - "dump:$domain:$username:roles", - $authhost); - $userroles=~s/&/\n/g; - { + while ($cookie=<$lonids/$username\_*\_$domain\_$authhost.id>) { + unlink($cookie); + } + +# Give them a new cookie + + 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 "username=$username\n"; - print $idf "userdomain=$domain\n"; - print $idf "userhome=$authhost\n"; - print $idf "$userroles\n"; + print $idf "user.name=$username\n"; + print $idf "user.domain=$domain\n"; + print $idf "user.home=$authhost\n"; + if ($userroles ne '') { print $idf "$userroles" }; } - } + +# ------------------------------------------------------------ Get cookie ready + $cookie="lonID=$cookie; path=/"; + +# ------------------------------------------------- Output for successful login + $r->send_cgi_header(<print(< -Successful Login to the LearningOnline Network +Successful Login to the LearningOnline Network with CAPA - + ENDSUCCESS @@ -66,12 +78,12 @@ ENDFHEADER $r->print(< -Unsuccessful Login to the LearningOnline Network +Unsuccessful Login to the LearningOnline Network with CAPA

Sorry ...

-

$message to use the LearningOnline Network

+

$message to use the LearningOnline Network with CAPA

ENDFAILED @@ -120,7 +132,7 @@ sub handler { if (!$lonurl) { failed($r,'Cookies need to be activated'); return OK; } my $lowerurl=$lonurl->value; - success($r,$lowerurl,$FORM{'uname'},$FORM{'udom'},$authhost); + success($r,$FORM{'uname'},$FORM{'udom'},$authhost); return OK; }