version 1.94.2.1, 2007/10/09 16:48:51
|
version 1.96, 2007/10/02 01:09:59
|
Line 30 package Apache::lonlogin;
|
Line 30 package Apache::lonlogin;
|
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use CGI::Cookie(); |
|
use Apache::File (); |
use Apache::File (); |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon(); |
use Apache::loncommon(); |
Line 69 sub handler {
|
Line 68 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 87 $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 158 ENDFAILED
|
Line 148 ENDFAILED
|
my $otherserver= &Apache::lonnet::absolute_url($host_name); |
my $otherserver= &Apache::lonnet::absolute_url($host_name); |
my $firsturl= |
my $firsturl= |
($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'}); |
($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'}); |
# ---------------------------------------------------------- Are we overloaded? |
# ---------------------------------------- Are we access server and overloaded? |
if ((($userloadpercent>100.0)||($loadpercent>100.0))) { |
if (($role eq 'access') && |
|
(($userloadpercent>100.0)||($loadpercent>100.0))) { |
my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent); |
my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent); |
if ($unloaded) { $otherserver=$unloaded; } |
if ($unloaded) { $otherserver=$unloaded; } |
} |
} |