--- loncom/auth/lonauth.pm 1999/10/13 17:48:52 1.1 +++ loncom/auth/lonauth.pm 2000/02/29 16:24:00 1.5 @@ -1,6 +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 Gerd Kortemeyer +# 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,2/24,2/28,2/29 Gerd Kortemeyer package Apache::lonauth; @@ -13,22 +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"; - { + 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 "Name: $username\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 @@ -58,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 @@ -112,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; }