version 1.68, 2005/08/30 21:14:20
|
version 1.71, 2005/12/28 16:46:47
|
Line 36 use Apache::lonnet;
|
Line 36 use Apache::lonnet;
|
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonauth(); |
use Apache::lonauth(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::migrateuser(); |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
|
|
|
&Apache::loncommon::get_unprocessed_cgi |
|
($ENV{'QUERY_STRING'}.'&'.$env{'request.querystring'}, |
|
['interface','username','domain','firsturl','localpath','localres', |
|
'token']); |
|
|
|
# -- check if they are a migrating user |
|
if (defined($env{'form.token'})) { |
|
return &Apache::migrateuser::handler($r); |
|
} |
|
|
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
&Apache::lonlocal::get_language_handle($r); |
&Apache::lonlocal::get_language_handle($r); |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
Line 52 sub handler {
|
Line 64 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
|
|
# -------------------------------- Prevent users from attempting to login twice |
# -------------------------------- Prevent users from attempting to login twice |
my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); |
my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); |
my $lonid=$cookies{'lonID'}; |
my $lonid=$cookies{'lonID'}; |
Line 60 sub handler {
|
Line 73 sub handler {
|
my $handle=$lonid->value; |
my $handle=$lonid->value; |
$handle=~s/\W//g; |
$handle=~s/\W//g; |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { |
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 |
|
unlink("$lonidsdir/$handle.id"); |
|
} elsif ($handle ne '') { |
# Indeed, a valid token is found |
# Indeed, a valid token is found |
my $bodytag=&Apache::loncommon::bodytag('Already logged in'); |
my $bodytag=&Apache::loncommon::bodytag('Already logged in'); |
$r->print(<<ENDFAILED); |
$r->print(<<ENDFAILED); |
<html> |
<html> |
<head> |
<head> |
<title>Already logged in</title> |
<title>Already logged in</title> |
Line 77 $bodytag
|
Line 95 $bodytag
|
</body> |
</body> |
</html> |
</html> |
ENDFAILED |
ENDFAILED |
return OK; |
return OK; |
|
} |
} |
} |
} |
} |
|
|
# ---------------------------------------------------- No valid token, continue |
# ---------------------------------------------------- No valid token, continue |
|
|
&Apache::loncommon::get_unprocessed_cgi |
# ---------------------------- Not possible to really login to domain "public" |
($ENV{'QUERY_STRING'}.'&'.$env{'request.querystring'}, |
if ($env{'form.domain'} eq 'public') { |
['interface','username','domain','firsturl','localpath','localres']); |
$env{'form.domain'}=''; |
|
$env{'form.username'}=''; |
|
} |
# ----------------------------------------------------------- Process Interface |
# ----------------------------------------------------------- Process Interface |
$env{'form.interface'}=~s/\W//g; |
$env{'form.interface'}=~s/\W//g; |
|
|