version 1.186, 2021/09/28 20:47:46
|
version 1.191, 2021/10/10 23:22:30
|
Line 38 use Apache::lonlocal;
|
Line 38 use Apache::lonlocal;
|
use Apache::migrateuser();
|
use Apache::migrateuser();
|
use lib '/home/httpd/lib/perl/';
|
use lib '/home/httpd/lib/perl/';
|
use LONCAPA qw(:DEFAULT :match);
|
use LONCAPA qw(:DEFAULT :match);
|
|
use URI::Escape;
|
|
use HTML::Entities();
|
use CGI::Cookie();
|
use CGI::Cookie();
|
|
|
sub handler {
|
sub handler {
|
Line 60 sub handler {
|
Line 62 sub handler {
|
(!$env{'form.ltoken'}) && (!$env{'form.linkkey'})) {
|
(!$env{'form.ltoken'}) && (!$env{'form.linkkey'})) {
|
&Apache::lonacc::get_posted_cgi($r,['linkkey']);
|
&Apache::lonacc::get_posted_cgi($r,['linkkey']);
|
}
|
}
|
|
if ($env{'form.firsturl'} eq '/adm/logout') {
|
|
delete($env{'form.firsturl'});
|
|
}
|
|
|
# -- check if they are a migrating user
|
# -- check if they are a migrating user
|
if (defined($env{'form.token'})) {
|
if (defined($env{'form.token'})) {
|
Line 111 sub handler {
|
Line 116 sub handler {
|
}
|
}
|
|
|
my $lonhost = $r->dir_config('lonHostID');
|
my $lonhost = $r->dir_config('lonHostID');
|
$env{'form.firsturl'} =~ s/(`)/'/g;
|
|
|
|
# Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)
|
# Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)
|
|
|
Line 123 sub handler {
|
Line 127 sub handler {
|
$protocol = 'http' if ($protocol ne 'https');
|
$protocol = 'http' if ($protocol ne 'https');
|
my $dest = '/adm/roles';
|
my $dest = '/adm/roles';
|
if ($env{'form.firsturl'} ne '') {
|
if ($env{'form.firsturl'} ne '') {
|
$dest = $env{'form.firsturl'};
|
if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
|
|
$dest = &uri_escape_utf8($env{'form.firsturl'});
|
|
} else {
|
|
$dest = &uri_escape($env{'form.firsturl'});
|
|
}
|
|
$dest = &HTML::Entities::encode($dest,"'");
|
}
|
}
|
my %info = (
|
my %info = (
|
balcookie => $lonhost.':'.$balancer_cookie,
|
balcookie => $lonhost.':'.$balancer_cookie,
|
Line 141 sub handler {
|
Line 150 sub handler {
|
}
|
}
|
my $balancer_token = &Apache::lonnet::tmpput(\%info,$found_server);
|
my $balancer_token = &Apache::lonnet::tmpput(\%info,$found_server);
|
if ($balancer_token) {
|
if ($balancer_token) {
|
$dest .= (($dest=~/\?/)?'&;':'?') . 'btoken='.$balancer_token;
|
$dest .= (($dest=~/\?/)?'&':'?') . 'btoken='.$balancer_token;
|
}
|
}
|
unless ($found_server eq $lonhost) {
|
unless ($found_server eq $lonhost) {
|
my $alias = &Apache::lonnet::use_proxy_alias($r,$found_server);
|
my $alias = &Apache::lonnet::use_proxy_alias($r,$found_server);
|
Line 203 sub handler {
|
Line 212 sub handler {
|
&Apache::loncommon::end_page();
|
&Apache::loncommon::end_page();
|
my $dest = '/adm/roles';
|
my $dest = '/adm/roles';
|
if ($env{'form.firsturl'} ne '') {
|
if ($env{'form.firsturl'} ne '') {
|
$dest = $env{'form.firsturl'};
|
if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
|
|
$dest = &uri_escape_utf8($env{'form.firsturl'});
|
|
} else {
|
|
$dest = &uri_escape($env{'form.firsturl'});
|
|
}
|
|
$dest = &HTML::Entities::encode($dest,"'");
|
}
|
}
|
if (($env{'form.ltoken'}) || ($linkprot)) {
|
if (($env{'form.ltoken'}) || ($linkprot)) {
|
unless ($linkprot) {
|
unless ($linkprot) {
|
Line 403 sub handler {
|
Line 417 sub handler {
|
}
|
}
|
if ($env{'form.ltoken'}) {
|
if ($env{'form.ltoken'}) {
|
my %info = &Apache::lonnet::tmpget($env{'form.ltoken'});
|
my %info = &Apache::lonnet::tmpget($env{'form.ltoken'});
|
&Apache::lonnet::tmpdel($env{'form.ltoken'});
|
|
delete($env{'form.ltoken'});
|
|
if ($info{'linkprot'}) {
|
if ($info{'linkprot'}) {
|
if (!$tokenextras) {
|
if (!$tokenextras) {
|
$tokenextras = '&&&';
|
$tokenextras = '&&&';
|
Line 428 sub handler {
|
Line 440 sub handler {
|
if ($logtoken eq 'no_such_host') {
|
if ($logtoken eq 'no_such_host') {
|
&Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');
|
&Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');
|
}
|
}
|
|
if ($env{'form.ltoken'}) {
|
|
&Apache::lonnet::tmpdel($env{'form.ltoken'});
|
|
delete($env{'form.ltoken'});
|
|
}
|
my $spares='';
|
my $spares='';
|
my (@sparehosts,%spareservers);
|
my (@sparehosts,%spareservers);
|
my $sparesref = &Apache::lonnet::this_host_spares($defdom);
|
my $sparesref = &Apache::lonnet::this_host_spares($defdom);
|
Line 795 HEADER
|
Line 811 HEADER
|
if ($samlssourl ne '') {
|
if ($samlssourl ne '') {
|
$ssologin = $samlssourl;
|
$ssologin = $samlssourl;
|
}
|
}
|
|
if ($env{'form.firsturl'} ne '') {
|
|
my $querystring = 'origurl=';
|
|
if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
|
|
$querystring .= &uri_escape_utf8($env{'form.firsturl'});
|
|
} else {
|
|
$querystring .= &uri_escape($env{'form.firsturl'});
|
|
}
|
|
$querystring = &HTML::Entities::encode($querystring,"'");
|
|
$ssologin .= (($ssologin=~/\?/)?'&':'?') . $querystring;
|
|
}
|
|
if ($env{'form.ltoken'} ne '') {
|
|
$querystring .= (($querystring eq '')?'':'&') . 'ltoken='.
|
|
&HTML::Entities::encode(&uri_escape($env{'form.ltoken'}));
|
|
} elsif ($env{'form.linkkey'}) {
|
|
$querystring .= (($querystring eq '')?'':'&') . 'linkkey='.
|
|
&HTML::Entities::encode(&uri_escape($env{'form.linkkey'}));
|
|
}
|
my $ssohref;
|
my $ssohref;
|
if ($samlssoimg ne '') {
|
if ($samlssoimg ne '') {
|
$ssohref = '<a href="'.$ssologin.'" title="'.$samltooltip.'"><img src="'.$samlssoimg.'" alt="'.$samlssoalt.'" /></a>';
|
$ssohref = '<a href="'.$ssologin.'" title="'.$samltooltip.'"><img src="'.$samlssoimg.'" alt="'.$samlssoalt.'" /></a>';
|
} else {
|
} else {
|
$ssohref = '<a href="'.$ssologin.'">'.$samlssotext.'</a>';
|
$ssohref = '<a href="'.$ssologin.'">'.$samlssotext.'</a>';
|
}
|
}
|
if ($env{'form.firsturl'}) {
|
|
$ssologin .= '?origurl='.&HTML::Entities::encode($env{'form.firsturl'},'<>&"');
|
|
}
|
|
if (($env{'form.saml'} eq 'no') ||
|
if (($env{'form.saml'} eq 'no') ||
|
(($env{'form.username'} ne '') && ($env{'form.domain'} ne ''))) {
|
(($env{'form.username'} ne '') && ($env{'form.domain'} ne ''))) {
|
$ssoauthstyle = 'none';
|
$ssoauthstyle = 'none';
|
Line 828 $coursecatalog
|
Line 858 $coursecatalog
|
</div>
|
</div>
|
</div>
|
</div>
|
ENDSAML
|
ENDSAML
|
|
} else {
|
|
if ($env{'form.ltoken'}) {
|
|
&Apache::lonnet::tmpdel($env{'form.ltoken'});
|
|
delete($env{'form.ltoken'});
|
|
}
|
}
|
}
|
|
|
$r->print(<<ENDLOGIN);
|
$r->print(<<ENDLOGIN);
|
Line 1021 sub redirect_page {
|
Line 1056 sub redirect_page {
|
}
|
}
|
my $url = $protocol.'://'.$hostname.$path;
|
my $url = $protocol.'://'.$hostname.$path;
|
if ($env{'form.firsturl'} ne '') {
|
if ($env{'form.firsturl'} ne '') {
|
$url .='?firsturl='.$env{'form.firsturl'};
|
my $querystring;
|
|
if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
|
|
$querystring = &uri_escape_utf8($env{'form.firsturl'});
|
|
} else {
|
|
$querystring = &uri_escape($env{'form.firsturl'});
|
|
}
|
|
$querystring = &HTML::Entities::encode($querystring,"'");
|
|
$url .='?firsturl='.$querystring
|
}
|
}
|
if ($linkprot) {
|
if ($linkprot) {
|
my $ltoken = &Apache::lonnet::tmpput({linkprot => $linkprot},$desthost);
|
my $ltoken = &Apache::lonnet::tmpput({linkprot => $linkprot},$desthost);
|
if ($ltoken) {
|
if ($ltoken) {
|
$url .= (($url =~ /\?/) ? '&' : '?').'ltoken='.$ltoken;
|
$url .= (($url =~ /\?/) ? '&' : '?').'ltoken='.$ltoken;
|
}
|
}
|
}
|
}
|
my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
|
my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
|