--- loncom/auth/lonauth.pm 2003/10/30 00:54:57 1.58 +++ 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.58 2003/10/30 00:54:57 www Exp $ +# $Id: lonauth.pm,v 1.59 2003/11/12 16:55:40 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -277,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); @@ -347,7 +384,8 @@ sub handler { return OK; } - if (($firsturl eq '') || ($firsturl eq '/adm/logout')) { + if (($firsturl eq '') || + ($firsturl=~/^\/adm\/(logout|remote)/)) { $firsturl='/adm/roles'; }