--- loncom/auth/lonauth.pm 2007/07/25 22:35:47 1.88 +++ loncom/auth/lonauth.pm 2007/10/01 23:56:14 1.89 @@ -1,7 +1,7 @@ # The LearningOnline Network # User Authentication Module # -# $Id: lonauth.pm,v 1.88 2007/07/25 22:35:47 albertel Exp $ +# $Id: lonauth.pm,v 1.89 2007/10/01 23:56:14 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -32,7 +32,6 @@ use strict; use LONCAPA; use Apache::Constants qw(:common); use CGI qw(:standard); -use CGI::Cookie(); use DynaLoader; # for Crypt::DES version use Crypt::DES; use Apache::loncommon(); @@ -170,21 +169,16 @@ 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=&LONCAPA::clean_handle($lonid->value); - my $lonidsdir=$r->dir_config('lonIDsDir'); - if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { + my $handle = &Apache::lonnet::check_for_valid_session($r); + if ($handle ne '') { # Indeed, a valid token is found - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - my $start_page = - &Apache::loncommon::start_page('Already logged in'); - my $end_page = - &Apache::loncommon::end_page(); - $r->print(<send_http_header; + my $start_page = + &Apache::loncommon::start_page('Already logged in'); + my $end_page = + &Apache::loncommon::end_page(); + $r->print(<You are already logged in

Please either continue the current session or @@ -193,8 +187,7 @@ $start_page Problems?

$end_page ENDFAILED - return OK; - } + return OK; } # ---------------------------------------------------- No valid token, continue