version 1.93, 2007/04/17 15:44:58
|
version 1.95, 2007/10/01 21:52:50
|
Line 69 sub handler {
|
Line 69 sub handler {
|
|
|
|
|
# -------------------------------- Prevent users from attempting to login twice |
# -------------------------------- Prevent users from attempting to login twice |
my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); |
my $handle = &Apache::lonnet::check_for_valid_session($r); |
my $lonid=$cookies{'lonID'}; |
if ($handle=~/^publicuser\_/) { |
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\_/) { |
|
# For "public user" - remove it, we apparently really want to login |
# For "public user" - remove it, we apparently really want to login |
unlink("$lonidsdir/$handle.id"); |
unlink($r->dir_config('lonIDsDir')."/$handle.id"); |
} elsif ($handle ne '') { |
} elsif ($handle ne '') { |
# Indeed, a valid token is found |
# Indeed, a valid token is found |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Already logged in'); |
&Apache::loncommon::start_page('Already logged in'); |
my $end_page = |
my $end_page = |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
$r->print(<<ENDFAILED); |
$r->print(<<ENDFAILED); |
$start_page |
$start_page |
<h1>You are already logged in</h1> |
<h1>You are already logged in</h1> |
<p>Please either <a href="/adm/roles">continue the current session</a> or |
<p>Please either <a href="/adm/roles">continue the current session</a> or |
Line 95 $start_page
|
Line 88 $start_page
|
<a href="/adm/loginproblems.html">Problems?</a></p> |
<a href="/adm/loginproblems.html">Problems?</a></p> |
$end_page |
$end_page |
ENDFAILED |
ENDFAILED |
return OK; |
return OK; |
} |
|
} |
|
} |
} |
|
|
# ---------------------------------------------------- No valid token, continue |
# ---------------------------------------------------- No valid token, continue |
Line 120 ENDFAILED
|
Line 111 ENDFAILED
|
} |
} |
|
|
my $fullgraph=($env{'form.interface'} ne 'textual'); |
my $fullgraph=($env{'form.interface'} ne 'textual'); |
my $port_to_use=$r->dir_config('lonhttpdPort'); |
|
if (!defined($port_to_use)) { |
my $iconpath= |
$port_to_use='8080'; |
&Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL')); |
} |
|
my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use. |
|
$r->dir_config('lonIconsURL'); |
|
my $domain = &Apache::lonnet::default_login_domain(); |
my $domain = &Apache::lonnet::default_login_domain(); |
if (($env{'form.domain'}) && |
if (($env{'form.domain'}) && |
(&Apache::lonnet::domain($env{'form.domain'},'description'))) { |
(&Apache::lonnet::domain($env{'form.domain'},'description'))) { |