--- loncom/auth/lonlogin.pm 2007/04/06 22:06:02 1.91 +++ loncom/auth/lonlogin.pm 2007/10/02 01:09:59 1.96 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.91 2007/04/06 22:06:02 raeburn Exp $ +# $Id: lonlogin.pm,v 1.96 2007/10/02 01:09:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,7 +30,6 @@ package Apache::lonlogin; use strict; use Apache::Constants qw(:common); -use CGI::Cookie(); use Apache::File (); use Apache::lonnet; use Apache::loncommon(); @@ -69,24 +68,17 @@ sub handler { # -------------------------------- 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") { -# Is there an existing token file? - if ($handle=~/^publicuser\_/) { + my $handle = &Apache::lonnet::check_for_valid_session($r); + if ($handle=~/^publicuser\_/) { # For "public user" - remove it, we apparently really want to login - unlink("$lonidsdir/$handle.id"); - } elsif ($handle ne '') { + unlink($r->dir_config('lonIDsDir')."/$handle.id"); + } elsif ($handle ne '') { # Indeed, a valid token is found - my $start_page = - &Apache::loncommon::start_page('Already logged in'); - my $end_page = - &Apache::loncommon::end_page(); - $r->print(<print(<You are already logged in

Please either continue the current session or @@ -95,9 +87,7 @@ $start_page Problems?

$end_page ENDFAILED - return OK; - } - } + return OK; } # ---------------------------------------------------- No valid token, continue @@ -120,12 +110,10 @@ ENDFAILED } my $fullgraph=($env{'form.interface'} ne 'textual'); - my $port_to_use=$r->dir_config('lonhttpdPort'); - if (!defined($port_to_use)) { - $port_to_use='8080'; - } - my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use. - $r->dir_config('lonIconsURL'); + + my $iconpath= + &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL')); + my $domain = &Apache::lonnet::default_login_domain(); if (($env{'form.domain'}) && (&Apache::lonnet::domain($env{'form.domain'},'description'))) { @@ -386,7 +374,7 @@ ENDSCRIPT ENDSERVERFORM my $coursecatalog; - if ($showcoursecat eq '' || $showcoursecat)) { + if (($showcoursecat eq '') || ($showcoursecat)) { $coursecatalog = &coursecatalog_link($lt{'catalog'}); } if ($fullgraph) { $r->print(< User Authentication -
   $lt{'un'}: +
   :
-    $lt{'pw'}: +    : -    $lt{'dom'}: +    :