--- loncom/auth/lonauth.pm 2003/09/20 17:44:22 1.57 +++ loncom/auth/lonauth.pm 2003/11/21 22:10:25 1.60 @@ -1,7 +1,7 @@ # The LearningOnline Network # User Authentication Module # -# $Id: lonauth.pm,v 1.57 2003/09/20 17:44:22 www Exp $ +# $Id: lonauth.pm,v 1.60 2003/11/21 22:10:25 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -184,13 +184,20 @@ sub success { my $setflags=&Apache::lonmenu::setflags(); my $maincall=&Apache::lonmenu::maincall(); my $bodytag=&Apache::loncommon::bodytag('Successful Login'); + my $add=&addcontent(); # ------------------------------------------------- Output for successful login $r->send_cgi_header(< 'Welcome', + 'mes' => 'Welcome to the LearningOnline Network with CAPA. Please wait while your session is being set up', + 'pro' => 'Problems', + 'log' => 'loginproblems.html', + ); $r->print(< @@ -200,11 +207,9 @@ $startupremote $bodytag $setflags $windowinfo -

Welcome!

-Welcome to the LearningOnline Network with CAPA. -Please wait while your session -is being set up.

-Problems?

+

$lt{'wel'}

+$lt{'mes'}.

+$lt{'pro'}?

$maincall @@ -216,8 +221,9 @@ ENDSUCCESS sub failed { my ($r,$message) = @_; my $bodytag=&Apache::loncommon::bodytag('Unsuccessful Login'); + my $add=&addcontent(); $r->send_cgi_header(<print(<parse($r->header_in('Cookie')); + my $lonid=$cookies{'lonID'}; + my $cookie; + if ($lonid) { + my $handle=$lonid->value; + $handle=~s/\W//g; + my $lonidsdir=$r->dir_config('lonIDsDir'); + if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { +# Indeed, a valid token is found + $r->send_cgi_header(<print(< + +Already logged in + + +$bodytag +

You are already logged in

+

Please either continue the current session or +logout.

+

+Problems?

+ + +ENDFAILED + return OK; + } + } + +# ---------------------------------------------------- No valid token, continue + + my $buffer; $r->read($buffer,$r->header_in('Content-length'),0); my @pairs=split(/&/,$buffer); @@ -343,7 +397,8 @@ sub handler { return OK; } - if (($firsturl eq '') || ($firsturl eq '/adm/logout')) { + if (($firsturl eq '') || + ($firsturl=~/^\/adm\/(logout|remote)/)) { $firsturl='/adm/roles'; }