--- loncom/auth/lonauth.pm 2003/09/20 17:44:22 1.57 +++ loncom/auth/lonauth.pm 2003/11/12 16:55:40 1.59 @@ -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.59 2003/11/12 16:55:40 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -191,6 +191,12 @@ Content-type: text/html Set-cookie: $cookie ENDHEADER + my %lt=&Apache::lonlocal::texthash( + 'wel' => '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 +206,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 @@ -273,6 +277,43 @@ sub handler { &Apache::lonlocal::get_language_handle($r); +# -------------------------------- Prevent users from attempting to login twice + my %cookies=CGI::Cookie->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 +384,8 @@ sub handler { return OK; } - if (($firsturl eq '') || ($firsturl eq '/adm/logout')) { + if (($firsturl eq '') || + ($firsturl=~/^\/adm\/(logout|remote)/)) { $firsturl='/adm/roles'; }