version 1.195, 2022/02/24 15:51:28
|
version 1.213, 2025/02/25 16:33:37
|
Line 50 sub handler {
|
Line 50 sub handler {
|
$ENV{'REDIRECT_QUERY_STRING'}),
|
$ENV{'REDIRECT_QUERY_STRING'}),
|
['interface','username','domain','firsturl','localpath','localres',
|
['interface','username','domain','firsturl','localpath','localres',
|
'token','role','symb','iptoken','btoken','ltoken','ttoken','linkkey',
|
'token','role','symb','iptoken','btoken','ltoken','ttoken','linkkey',
|
'saml','sso','retry']);
|
'saml','sso','retry','display']);
|
|
|
# -- 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 68 sub handler {
|
Line 68 sub handler {
|
$env{'form.ltoken'} = $info{'ltoken'};
|
$env{'form.ltoken'} = $info{'ltoken'};
|
} elsif ($info{'linkprot'}) {
|
} elsif ($info{'linkprot'}) {
|
$env{'form.linkprot'} = $info{'linkprot'};
|
$env{'form.linkprot'} = $info{'linkprot'};
|
|
foreach my $item ('linkprotuser','linkprotexit','linkprotpbid','linkprotpburl') {
|
|
if ($info{$item} ne '') {
|
|
$env{'form.'.$item} = $info{$item};
|
|
}
|
|
}
|
} elsif ($info{'linkkey'} ne '') {
|
} elsif ($info{'linkkey'} ne '') {
|
$env{'form.linkkey'} = $info{'linkkey'};
|
$env{'form.linkkey'} = $info{'linkkey'};
|
}
|
}
|
Line 170 sub handler {
|
Line 175 sub handler {
|
if ($env{'form.symb'}) {
|
if ($env{'form.symb'}) {
|
$info{'symb'} = $env{'form.symb'};
|
$info{'symb'} = $env{'form.symb'};
|
}
|
}
|
|
if (($env{'form.firsturl'} eq '/adm/email') && ($env{'form.display'} ne '')) {
|
|
if ($env{'form.sso'}) {
|
|
if ($env{'form.mailrecip'}) {
|
|
$info{'display'} = &escape($env{'form.display'});
|
|
$info{'mailrecip'} = &escape($env{'form.mailrecip'});
|
|
}
|
|
} else {
|
|
if (($env{'form.username'}) && ($env{'form.domain'})) {
|
|
$info{'display'} = &escape($env{'form.display'});
|
|
$info{'mailrecip'} = &escape($env{'form.username'}.':'.$env{'form.domain'});
|
|
}
|
|
}
|
|
}
|
my $balancer_token = &Apache::lonnet::tmpput(\%info,$found_server);
|
my $balancer_token = &Apache::lonnet::tmpput(\%info,$found_server);
|
unless (($balancer_token eq 'con_lost') || ($balancer_token eq 'refused') ||
|
unless (($balancer_token eq 'con_lost') || ($balancer_token eq 'refused') ||
|
($balancer_token eq 'unknown_cmd') || ($balancer_token eq 'no_such_host')) {
|
($balancer_token eq 'unknown_cmd') || ($balancer_token eq 'no_such_host')) {
|
Line 181 sub handler {
|
Line 199 sub handler {
|
$link_info{'ltoken'} = $env{'form.ltoken'};
|
$link_info{'ltoken'} = $env{'form.ltoken'};
|
} elsif ($env{'form.linkprot'}) {
|
} elsif ($env{'form.linkprot'}) {
|
$link_info{'linkprot'} = $env{'form.linkprot'};
|
$link_info{'linkprot'} = $env{'form.linkprot'};
|
|
foreach my $item ('linkprotuser','linkprotexit','linkprotpbid','linkprotpburl') {
|
|
if ($env{'form.'.$item} ne '') {
|
|
$link_info{$item} = $env{'form.'.$item};
|
|
}
|
|
}
|
} elsif ($env{'form.linkkey'} ne '') {
|
} elsif ($env{'form.linkkey'} ne '') {
|
$link_info{'linkkey'} = $env{'form.linkkey'};
|
$link_info{'linkkey'} = $env{'form.linkkey'};
|
}
|
}
|
Line 218 sub handler {
|
Line 241 sub handler {
|
$balcookie = $info{'balcookie'};
|
$balcookie = $info{'balcookie'};
|
&Apache::lonnet::tmpdel($env{'form.btoken'});
|
&Apache::lonnet::tmpdel($env{'form.btoken'});
|
delete($env{'form.btoken'});
|
delete($env{'form.btoken'});
|
|
if (($env{'form.firsturl'} eq '/adm/email') &&
|
|
(exists($info{'display'})) && (exists($info{'mailrecip'}))) {
|
|
$env{'form.display'} = &unescape($info{'display'});
|
|
$env{'form.mailrecip'} = &unescape($info{'mailrecip'});
|
|
}
|
}
|
}
|
|
|
|
(undef,undef,undef,my $clientmathml,my $clientunicode,undef,my $clientmobile) =
|
|
&Apache::loncommon::decode_user_agent($r);
|
|
|
#
|
#
|
# If browser sent an old cookie for which the session file had been removed
|
# If browser sent an old cookie for which the session file had been removed
|
# check if configuration for user's domain has a portal URL set. If so
|
# check if configuration for user's domain has a portal URL set. If so
|
Line 240 sub handler {
|
Line 271 sub handler {
|
# -------------------------------- Prevent users from attempting to login twice
|
# -------------------------------- Prevent users from attempting to login twice
|
if ($handle ne '') {
|
if ($handle ne '') {
|
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
|
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
|
|
my $args = {};
|
|
if ($clientunicode && !$clientmathml) {
|
|
$args->{'browser.unicode'} = 1;
|
|
}
|
my $start_page =
|
my $start_page =
|
&Apache::loncommon::start_page('Already logged in');
|
&Apache::loncommon::start_page('Already logged in','',$args);
|
my $end_page =
|
my $end_page =
|
&Apache::loncommon::end_page();
|
&Apache::loncommon::end_page();
|
my $dest = '/adm/roles';
|
my $dest = '/adm/roles';
|
Line 249 sub handler {
|
Line 284 sub handler {
|
$dest = &HTML::Entities::encode($env{'form.firsturl'},'\'"<>&');
|
$dest = &HTML::Entities::encode($env{'form.firsturl'},'\'"<>&');
|
}
|
}
|
if (($env{'form.ltoken'}) || ($env{'form.linkprot'})) {
|
if (($env{'form.ltoken'}) || ($env{'form.linkprot'})) {
|
my $linkprot;
|
my ($linkprot,$linkprotuser,$linkprotexit,$linkprotpbid,$linkprotpburl);
|
if ($env{'form.ltoken'}) {
|
if ($env{'form.ltoken'}) {
|
my %info = &Apache::lonnet::tmpget($env{'form.ltoken'});
|
my %info = &Apache::lonnet::tmpget($env{'form.ltoken'});
|
$linkprot = $info{'linkprot'};
|
$linkprot = $info{'linkprot'};
|
my $delete = &Apache::lonnet::tmpdel($env{'form.ltoken'});
|
if ($info{'linkprotuser'} ne '') {
|
|
$linkprotuser = $info{'linkprotuser'};
|
|
}
|
|
if ($info{'linkprotexit'} ne '') {
|
|
$linkprotexit = $info{'linkprotexit'};
|
|
}
|
|
if ($info{'linkprotpbid'} ne '') {
|
|
$linkprotpbid = $info{'linkprotpbid'};
|
|
}
|
|
if ($info{'linkprotpburl'} ne '') {
|
|
$linkprotpburl = $info{'linkprotpburl'};
|
|
}
|
} else {
|
} else {
|
$linkprot = $env{'form.linkprot'};
|
$linkprot = $env{'form.linkprot'};
|
|
$linkprotuser = $env{'form.linkprotuser'};
|
|
$linkprotexit = $env{'form.linkprotexit'};
|
|
$linkprotpbid = $env{'form.linkprotpbid'};
|
|
$linkprotpburl = $env{'form.linkprotpburl'};
|
}
|
}
|
if ($linkprot) {
|
if ($linkprot) {
|
my ($linkprotector,$deeplink) = split(/:/,$linkprot,2);
|
my ($linkprotector,$deeplink) = split(/:/,$linkprot,2);
|
|
if (($deeplink =~ m{^/tiny/$match_domain/\w+$}) &&
|
|
($linkprotuser ne '') && ($linkprotuser ne $env{'user.name'}.':'.$env{'user.domain'})) {
|
|
my $ip = &Apache::lonnet::get_requestor_ip();
|
|
my %linkprotinfo = (
|
|
origurl => $deeplink,
|
|
linkprot => $linkprot,
|
|
linkprotuser => $linkprotuser,
|
|
linkprotexit => $linkprotexit,
|
|
linkprotpbid => $linkprotpbid,
|
|
linkprotpburl => $linkprotpburl,
|
|
);
|
|
if ($env{'form.ltoken'}) {
|
|
my $delete = &Apache::lonnet::tmpdel($env{'form.ltoken'});
|
|
}
|
|
&Apache::migrateuser::logout($r,$ip,$handle,undef,undef,\%linkprotinfo);
|
|
return OK;
|
|
}
|
if ($env{'user.linkprotector'}) {
|
if ($env{'user.linkprotector'}) {
|
my @protectors = split(/,/,$env{'user.linkprotector'});
|
my @protectors = split(/,/,$env{'user.linkprotector'});
|
unless (grep(/^\Q$linkprotector\E$/,@protectors)) {
|
unless (grep(/^\Q$linkprotector\E$/,@protectors)) {
|
Line 304 sub handler {
|
Line 371 sub handler {
|
}
|
}
|
}
|
}
|
}
|
}
|
|
if ($env{'form.ltoken'}) {
|
|
my $delete = &Apache::lonnet::tmpdel($env{'form.ltoken'});
|
|
}
|
|
if (($env{'form.firsturl'} eq '/adm/email') && ($env{'form.display'})) {
|
|
if ($env{'form.mailrecip'}) {
|
|
if ($env{'form.mailrecip'} eq "$env{'user.name'}:$env{'user.domain'}") {
|
|
$dest .= (($dest=~/\?/)?'&':'?') . 'display='.&escape($env{'form.display'}).
|
|
'&mailrecip='.&escape($env{'form.mailrecip'});
|
|
}
|
|
} elsif (($env{'form.username'} eq $env{'user.name'}) && ($env{'form.domain'} eq $env{'user.domain'})) {
|
|
$dest .= (($dest=~/\?/)?'&':'?') . 'display='.&escape($env{'form.display'}).
|
|
'&mailrecip='.&escape("$env{'user.name'}:$env{'form.domain'}");
|
|
}
|
|
}
|
$r->print(
|
$r->print(
|
$start_page
|
$start_page
|
|
.'<div class="LC_landmark" role="main">'
|
.'<p class="LC_warning">'.&mt('You are already logged in!').'</p>'
|
.'<p class="LC_warning">'.&mt('You are already logged in!').'</p>'
|
.'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
|
.'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
|
'<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
|
'<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
|
|
.'</div>'
|
.$end_page
|
.$end_page
|
);
|
);
|
return OK;
|
return OK;
|
Line 334 sub handler {
|
Line 417 sub handler {
|
# ----------------------------------------------------------- Process Interface
|
# ----------------------------------------------------------- Process Interface
|
$env{'form.interface'}=~s/\W//g;
|
$env{'form.interface'}=~s/\W//g;
|
|
|
(undef,undef,undef,undef,undef,undef,my $clientmobile) =
|
|
&Apache::loncommon::decode_user_agent($r);
|
|
|
|
my $iconpath=
|
my $iconpath=
|
&Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
|
&Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
|
|
|
Line 428 sub handler {
|
Line 508 sub handler {
|
if ($uextkey>2147483647) { $uextkey-=4294967296; }
|
if ($uextkey>2147483647) { $uextkey-=4294967296; }
|
|
|
# -------------------------------------------------------- Store away log token
|
# -------------------------------------------------------- Store away log token
|
my ($tokenextras,$tokentype);
|
my ($tokenextras,$tokentype,$linkprot_for_login);
|
my @names = ('role','symb','iptoken','ltoken','linkprot','linkkey');
|
my @names = ('role','symb','iptoken','ltoken','linkprotuser','linkprotexit',
|
|
'linkprot','linkkey','display','linkprotpbid','linkprotpburl');
|
foreach my $name (@names) {
|
foreach my $name (@names) {
|
if ($env{'form.'.$name} ne '') {
|
if ($env{'form.'.$name} ne '') {
|
if ($name eq 'ltoken') {
|
if ($name eq 'ltoken') {
|
my %info = &Apache::lonnet::tmpget($env{'form.'.$name});
|
my %info = &Apache::lonnet::tmpget($env{'form.'.$name});
|
if ($info{'linkprot'}) {
|
if ($info{'linkprot'}) {
|
|
$linkprot_for_login = $info{'linkprot'};
|
$tokenextras .= '&linkprot='.&escape($info{'linkprot'});
|
$tokenextras .= '&linkprot='.&escape($info{'linkprot'});
|
|
foreach my $item ('linkprotuser','linkprotexit','linkprotpbid','linkprotpburl') {
|
|
if ($info{$item}) {
|
|
$tokenextras .= '&'.$item.'='.&escape($info{$item});
|
|
}
|
|
}
|
$tokentype = 'link';
|
$tokentype = 'link';
|
last;
|
last;
|
}
|
}
|
|
} elsif ($env{'form.display'} && ($env{'form.firsturl'} eq '/adm/email')) {
|
|
if (($env{'form.mailrecip'}) ||
|
|
($env{'form.username'} =~ /^$match_username$/) && ($env{'form.domain'} =~ /^$match_domain$/)) {
|
|
$tokenextras .= '&'.$name.'='.&escape($env{'form.display'});
|
|
if ($env{'form.mailrecip'}) {
|
|
$tokenextras .= '&mailrecip='.&escape($env{'form.mailrecip'});
|
|
} else {
|
|
$tokenextras .= '&mailrecip='.&escape($env{'form.username'}.':'.$env{'form.domain'});
|
|
}
|
|
}
|
} else {
|
} else {
|
$tokenextras .= '&'.$name.'='.&escape($env{'form.'.$name});
|
$tokenextras .= '&'.$name.'='.&escape($env{'form.'.$name});
|
if (($name eq 'linkkey') || ($name eq 'linkprot')) {
|
if (($name eq 'linkkey') || ($name eq 'linkprot')) {
|
|
if ((($env{'form.retry'}) || ($env{'form.sso'})) &&
|
|
(!$env{'form.ltoken'}) && ($name eq 'linkprot')) {
|
|
$linkprot_for_login = $env{'form.linkprot'};
|
|
}
|
$tokentype = 'link';
|
$tokentype = 'link';
|
}
|
}
|
}
|
}
|
Line 523 sub handler {
|
Line 624 sub handler {
|
.'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'
|
.'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'
|
.'<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>'
|
.'<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>'
|
.&mt('The LearningOnline Network with CAPA')
|
.&mt('The LearningOnline Network with CAPA')
|
.'</title></head>'
|
.'</title>'
|
|
.'<style type="text/css">
|
|
body {
|
|
background-color:"#FFFFFF";
|
|
}
|
|
h2 {
|
|
display: block;
|
|
font-size: 1.17em;
|
|
margin-top: 1em;
|
|
margin-bottom: 1em;
|
|
margin-left: 0;
|
|
margin-right: 0;
|
|
font-weight: bold;
|
|
}
|
|
.LC_landmark {
|
|
margin: 0;
|
|
padding: 0;
|
|
border: none;
|
|
}
|
|
</style></head>'
|
.'<body bgcolor="#FFFFFF">'
|
.'<body bgcolor="#FFFFFF">'
|
|
.'<div class="LC_landmark" role="banner">'
|
.'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
|
.'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
|
.'<img src="/adm/lonKaputt/lonlogo_broken.gif" alt="broken icon" align="right" />'
|
.'<img src="/adm/lonKaputt/lonlogo_broken.gif" alt="broken icon" align="right" />'
|
.'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>');
|
.'</div>'
|
|
.'<div class="LC_landmark" role="main">'
|
|
.'<h2>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h2>');
|
if ($spares) {
|
if ($spares) {
|
$r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
|
$r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
|
.'</p>'
|
.'</p>'
|
.$spares);
|
.$spares);
|
}
|
}
|
$r->print('</body>'
|
$r->print('</div></body>'
|
.'</html>'
|
.'</html>'
|
);
|
);
|
return OK;
|
return OK;
|
Line 619 function enableInput() {
|
Line 742 function enableInput() {
|
ENDSCRIPT
|
ENDSCRIPT
|
|
|
my ($lonhost_in_use,@hosts,%defaultdomconf,$saml_prefix,$saml_landing,
|
my ($lonhost_in_use,@hosts,%defaultdomconf,$saml_prefix,$saml_landing,
|
$samlssotext,$samlnonsso,$samlssoimg,$samlssoalt,$samlssourl,$samltooltip);
|
$samlssotext,$samlnonsso,$samlssoimg,$samlssoalt,$samlssourl,$samltooltip,
|
|
$samlwindow);
|
%defaultdomconf = &Apache::loncommon::get_domainconf($defdom);
|
%defaultdomconf = &Apache::loncommon::get_domainconf($defdom);
|
@hosts = &Apache::lonnet::current_machine_ids();
|
@hosts = &Apache::lonnet::current_machine_ids();
|
$lonhost_in_use = $lonhost;
|
$lonhost_in_use = $lonhost;
|
Line 640 ENDSCRIPT
|
Line 764 ENDSCRIPT
|
$samlssoalt = $defaultdomconf{$saml_prefix.'alt_'.$lonhost_in_use};
|
$samlssoalt = $defaultdomconf{$saml_prefix.'alt_'.$lonhost_in_use};
|
$samlssourl = $defaultdomconf{$saml_prefix.'url_'.$lonhost_in_use};
|
$samlssourl = $defaultdomconf{$saml_prefix.'url_'.$lonhost_in_use};
|
$samltooltip = $defaultdomconf{$saml_prefix.'title_'.$lonhost_in_use};
|
$samltooltip = $defaultdomconf{$saml_prefix.'title_'.$lonhost_in_use};
|
|
$samlwindow = $defaultdomconf{$saml_prefix.'window_'.$lonhost_in_use};
|
}
|
}
|
if ($saml_landing) {
|
if ($saml_landing) {
|
if ($samlssotext eq '') {
|
if ($samlssotext eq '') {
|
Line 715 ENDSAMLJS
|
Line 840 ENDSAMLJS
|
}
|
}
|
}
|
}
|
|
|
$r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
|
my $args = {
|
{ 'redirect' => [$expire,'/adm/roles'],
|
'redirect' => [$expire,'/adm/roles'],
|
'add_entries' => \%add_entries,
|
'add_entries' => \%add_entries,
|
'only_body' => 1,}));
|
'only_body' => 1,
|
|
};
|
|
if ($clientunicode && !$clientmathml) {
|
|
$args->{'browser.unicode'} = 1;
|
|
}
|
|
$r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',
|
|
$js,$args));
|
|
|
# ----------------------------------------------------------------------- Texts
|
# ----------------------------------------------------------------------- Texts
|
|
|
Line 738 ENDSAMLJS
|
Line 869 ENDSAMLJS
|
'forgotpw' => 'Forgot password?',
|
'forgotpw' => 'Forgot password?',
|
'newuser' => 'New User?',
|
'newuser' => 'New User?',
|
'change' => 'Change?',
|
'change' => 'Change?',
|
|
'nojs' => 'Use of LON-CAPA requires Javascript to be enabled in your web browser.',
|
);
|
);
|
# -------------------------------------------------- Change password field name
|
# -------------------------------------------------- Change password field name
|
|
|
my $forgotpw = &forgotpwdisplay(%lt);
|
my $forgotpw = &forgotpwdisplay(%lt);
|
$forgotpw .= '<br />' if $forgotpw;
|
if ($forgotpw) {
|
|
$forgotpw = '<div class="LC_login_links">'.
|
|
$forgotpw.'</div>';
|
|
}
|
my $loginhelp = &Apache::lonauth::loginhelpdisplay($authdomain);
|
my $loginhelp = &Apache::lonauth::loginhelpdisplay($authdomain);
|
if ($loginhelp) {
|
if ($loginhelp) {
|
$loginhelp = '<a href="'.$loginhelp.'">'.$lt{'help'}.'</a><br />';
|
$loginhelp = '<div class="LC_login_links">'.
|
|
'<a href="'.$loginhelp.'">'.$lt{'help'}.'</a></div>';
|
}
|
}
|
|
|
# ---------------------------------------------------- Serve out DES JavaScript
|
# ---------------------------------------------------- Serve out DES JavaScript
|
Line 760 ENDSAMLJS
|
Line 896 ENDSAMLJS
|
.' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
|
.' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
|
);
|
);
|
|
|
|
my $target = '_top';
|
|
if ($sessiondata{'linkprot'}) {
|
|
my ($linkprotector,$deeplink) = split(/:/,$sessiondata{'linkprot'},2);
|
|
if (($deeplink eq $sessiondata{'origurl'}) &&
|
|
(($sessiondata{'linkprotuser'} eq $sessiondata{'username'}.':'.$sessiondata{'domain'}) ||
|
|
($sessiondata{'linkprotuser'} eq $sessiondata{'username'}))) {
|
|
$target = '_self';
|
|
}
|
|
}
|
$r->print(<<ENDSERVERFORM);
|
$r->print(<<ENDSERVERFORM);
|
<form name="server" action="/adm/authenticate" method="post" target="_top">
|
<form name="server" action="/adm/authenticate" method="post" target="$target">
|
<input type="hidden" name="logtoken" value="$logtoken" />
|
<input type="hidden" name="logtoken" value="$logtoken" />
|
<input type="hidden" name="serverid" value="$lonhost" />
|
<input type="hidden" name="serverid" value="$lonhost" />
|
<input type="hidden" name="uname" value="" />
|
<input type="hidden" name="uname" value="" />
|
Line 773 ENDSAMLJS
|
Line 918 ENDSAMLJS
|
ENDSERVERFORM
|
ENDSERVERFORM
|
my $coursecatalog;
|
my $coursecatalog;
|
if (($showcoursecat eq '') || ($showcoursecat)) {
|
if (($showcoursecat eq '') || ($showcoursecat)) {
|
$coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';
|
$coursecatalog = '<div class="LC_login_links">'.
|
|
&coursecatalog_link($lt{'catalog'}).'</div>';
|
}
|
}
|
my $newuserlink;
|
my $newuserlink;
|
if ($shownewuserlink) {
|
if ($shownewuserlink) {
|
$newuserlink = &newuser_link($lt{'newuser'}).'<br />';
|
$newuserlink = '<div class="LC_login_links">'.
|
|
&newuser_link($lt{'newuser'}).'</div>';
|
}
|
}
|
my $logintitle =
|
my $logintitle =
|
'<h2 class="LC_hcell"'
|
'<h2 class="LC_hcell"'
|
Line 786 ENDSERVERFORM
|
Line 933 ENDSERVERFORM
|
.$lt{'log'}
|
.$lt{'log'}
|
.'</h2>';
|
.'</h2>';
|
|
|
my $noscript_warning='<noscript><span class="LC_warning"><b>'
|
my $noscript_warning = <<"ENDNOJS";
|
.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
|
<div aria-hidden="true" style="padding:0;margin:0;border:0">
|
.'</b></span></noscript>';
|
<noscript>
|
|
<span style="color: darkred; font-weight: bold;">$lt{'nojs'}</span>
|
|
</noscript>
|
|
</div>
|
|
<div class="LC_visually_hidden">
|
|
<noscript>
|
|
$lt{'nojs'}
|
|
</noscript>
|
|
</div>
|
|
ENDNOJS
|
my $helpdeskscript;
|
my $helpdeskscript;
|
my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
|
my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
|
$authdomain,\$helpdeskscript,
|
$authdomain,\$helpdeskscript,
|
Line 819 LFORM
|
Line 975 LFORM
|
}
|
}
|
$r->print(<<HEADER);
|
$r->print(<<HEADER);
|
<!-- The LON-CAPA Header -->
|
<!-- The LON-CAPA Header -->
|
<div style="background:$pgbg;margin:0;width:100%;">
|
<div style="background:$pgbg;margin:0;width:100%;" role="banner">
|
|
<h1 style="padding:0;margin:0">
|
<img src="$img" border="0" alt="$alttext" class="LC_maxwidth" id="lcloginbanner" />
|
<img src="$img" border="0" alt="$alttext" class="LC_maxwidth" id="lcloginbanner" />
|
|
</h1>
|
</div>
|
</div>
|
HEADER
|
HEADER
|
|
} else {
|
|
$r->print('<div role="banner" class="LC_visually_hidden" tabindex="-1">'.
|
|
'<h1>'.&mt('LON-CAPA Login Page').'</h1></div>');
|
}
|
}
|
|
|
my $stdauthformstyle = 'inline-block';
|
my $stdauthformstyle = 'inline-block';
|
my $ssoauthstyle = 'none';
|
my $ssoauthstyle = 'none';
|
|
my $sso_onclick;
|
my $logintype;
|
my $logintype;
|
$r->print('<div style="float:left;margin-top:0;">');
|
$r->print('<div style="float:left;margin-top:0;" role="main">');
|
if ($saml_landing) {
|
if ($saml_landing) {
|
$ssoauthstyle = 'inline-block';
|
$ssoauthstyle = 'inline-block';
|
$stdauthformstyle = 'none';
|
$stdauthformstyle = 'none';
|
Line 837 HEADER
|
Line 999 HEADER
|
if ($samlssourl ne '') {
|
if ($samlssourl ne '') {
|
$ssologin = $samlssourl;
|
$ssologin = $samlssourl;
|
}
|
}
|
|
my $ssologin_for_js = &js_escape($ssologin);
|
|
my $querystr_for_js;
|
if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
|
if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
|
my $querystring;
|
my $querystring;
|
if ($env{'form.firsturl'} ne '') {
|
if ($env{'form.firsturl'} ne '') {
|
Line 857 HEADER
|
Line 1021 HEADER
|
}
|
}
|
if ($querystring ne '') {
|
if ($querystring ne '') {
|
$ssologin .= (($ssologin=~/\?/)?'&':'?') . $querystring;
|
$ssologin .= (($ssologin=~/\?/)?'&':'?') . $querystring;
|
|
$querystr_for_js = &js_escape($querystring);
|
}
|
}
|
} elsif ($logtoken ne '') {
|
} elsif ($logtoken ne '') {
|
$ssologin .= (($ssologin=~/\?/)?'&':'?') . 'logtoken='.$logtoken;
|
$ssologin .= (($ssologin=~/\?/)?'&':'?') . 'logtoken='.$logtoken;
|
|
$querystr_for_js = &js_escape('logtoken='.$logtoken);
|
}
|
}
|
my $ssohref;
|
my $ssohref;
|
|
if ($samlwindow) {
|
|
$sso_onclick = <<"ENDJS";
|
|
if (document.getElementById('LC_sso_login_link')) {
|
|
var ssoelem = document.getElementById('LC_sso_login_link')
|
|
ssoelem.addEventListener('click',samlWinFunction,false);
|
|
var windows = {};
|
|
function samlWinFunction(evt) {
|
|
evt.preventDefault();
|
|
var url = '$ssologin_for_js';
|
|
var name = 'lcssowin';
|
|
var querystr = '$querystr_for_js';
|
|
if (querystr) {
|
|
url += '?'+querystr+'&lcssowin=1';
|
|
} else {
|
|
url += '?lcssowin=1';
|
|
}
|
|
if ((typeof windows[name] !== 'undefined') && (!windows[name].closed)) {
|
|
windows[name].close();
|
|
}
|
|
windows[name]=window.open(url,name,'width=350,height=600');
|
|
windows[name].focus();
|
|
return false;
|
|
}
|
|
}
|
|
ENDJS
|
|
}
|
if ($samlssoimg ne '') {
|
if ($samlssoimg ne '') {
|
$ssohref = '<a href="'.$ssologin.'" title="'.$samltooltip.'">'.
|
$ssohref = '<a href="'.$ssologin.'" title="'.$samltooltip.'" id="LC_sso_login_link">'.
|
'<img src="'.$samlssoimg.'" alt="'.$samlssoalt.'" id="lcssobutton" /></a>';
|
'<img src="'.$samlssoimg.'" alt="'.$samlssoalt.'" id="lcssobutton" /></a>';
|
} else {
|
} else {
|
$ssohref = '<a href="'.$ssologin.'">'.$samlssotext.'</a>';
|
$ssohref = '<a href="'.$ssologin.'" id="LC_sso_login_link">'.$samlssotext.'</a>';
|
}
|
}
|
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 ''))) {
|
Line 898 ENDSAML
|
Line 1090 ENDSAML
|
delete($env{'form.ltoken'});
|
delete($env{'form.ltoken'});
|
}
|
}
|
}
|
}
|
|
my $in_frame_js;
|
|
if ($linkprot_for_login) {
|
|
my ($linkprotector,$linkproturi) = split(/:/,$linkprot_for_login,2);
|
|
if (($linkprotector =~ /^\d+(c|d)$/) && ($linkproturi =~ m{^/+tiny/+$LONCAPA::match_domain/+\w+$})) {
|
|
my $set_target;
|
|
if (($env{'form.retry'}) || ($env{'form.sso'})) {
|
|
if ($linkproturi eq $env{'form.firsturl'}) {
|
|
$set_target = " document.server.target = '_self';";
|
|
}
|
|
} else {
|
|
$set_target = <<ENDTARG;
|
|
var linkproturi = '$linkproturi';
|
|
var path = document.location.pathname.replace( new RegExp('^/adm/launch'),'');
|
|
if (linkproturi == path) {
|
|
document.server.target = '_self';
|
|
}
|
|
ENDTARG
|
|
}
|
|
$in_frame_js = <<ENDJS;
|
|
<script type="text/javascript">
|
|
// <![CDATA[
|
|
if ((window.self !== window.top) && (document.server.target != '_self')) {
|
|
$set_target
|
|
$sso_onclick
|
|
}
|
|
// ]]>
|
|
</script>
|
|
ENDJS
|
|
}
|
|
} elsif ($samlwindow) {
|
|
$in_frame_js = <<ENDJS;
|
|
<script type="text/javascript">
|
|
// <![CDATA[
|
|
if ((window.self !== window.top) && (document.server.target != '_self')) {
|
|
$sso_onclick
|
|
}
|
|
// ]]>
|
|
</script>
|
|
ENDJS
|
|
}
|
|
|
$r->print(<<ENDLOGIN);
|
$r->print(<<ENDLOGIN);
|
<div style="display:$stdauthformstyle;" id="LC_standard_login">
|
<div style="display:$stdauthformstyle;" id="LC_standard_login">
|
Line 927 $announcements
|
Line 1159 $announcements
|
</div>
|
</div>
|
<hr style="clear:both;" />
|
<hr style="clear:both;" />
|
ENDTOP
|
ENDTOP
|
my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);
|
my ($domainrow,$serverrow,$loadrow,$userloadrow,$versioninfo);
|
$domainrow = <<"END";
|
$domainrow = <<"END";
|
<tr>
|
<tr>
|
<td align="left" valign="top">
|
<th align="left" valign="top">
|
<small><b>$lt{'dom'}: </b></small>
|
<small><b>$lt{'dom'}: </b></small>
|
</td>
|
</th>
|
<td align="left" valign="top">
|
<td align="left" valign="top">
|
<small><tt> $domain</tt></small>
|
<small><tt> $domain</tt></small>
|
</td>
|
</td>
|
</tr>
|
</tr>
|
END
|
END
|
$serverrow = <<"END";
|
$serverrow = <<"END";
|
<tr>
|
<tr>
|
<td align="left" valign="top">
|
<th align="left" valign="top">
|
<small><b>$lt{'serv'}: </b></small>
|
<small><b>$lt{'serv'}: </b></small>
|
</td>
|
</th>
|
<td align="left" valign="top">
|
<td align="left" valign="top">
|
<small><tt> $lonhost ($role)</tt></small>
|
<small><tt> $lonhost ($role)</tt></small>
|
</td>
|
</td>
|
Line 951 END
|
Line 1183 END
|
if ($loadlim) {
|
if ($loadlim) {
|
$loadrow = <<"END";
|
$loadrow = <<"END";
|
<tr>
|
<tr>
|
<td align="left" valign="top">
|
<th align="left" valign="top">
|
<small><b>$lt{'load'}: </b></small>
|
<small><b>$lt{'load'}: </b></small>
|
</td>
|
</th>
|
<td align="left" valign="top">
|
<td align="left" valign="top">
|
<small><tt> $loadpercent $lt{'perc'}</tt></small>
|
<small><tt> $loadpercent $lt{'perc'}</tt></small>
|
</td>
|
</td>
|
Line 963 END
|
Line 1195 END
|
if ($uloadlim) {
|
if ($uloadlim) {
|
$userloadrow = <<"END";
|
$userloadrow = <<"END";
|
<tr>
|
<tr>
|
<td align="left" valign="top">
|
<th align="left" valign="top">
|
<small><b>$lt{'userload'}: </b></small>
|
<small><b>$lt{'userload'}: </b></small>
|
</td>
|
</th>
|
<td align="left" valign="top">
|
<td align="left" valign="top">
|
<small><tt> $userloadpercent $lt{'perc'}</tt></small>
|
<small><tt> $userloadpercent $lt{'perc'}</tt></small>
|
</td>
|
</td>
|
Line 973 END
|
Line 1205 END
|
END
|
END
|
}
|
}
|
if (($version ne '') && ($version ne '<!-- VERSION -->')) {
|
if (($version ne '') && ($version ne '<!-- VERSION -->')) {
|
$versionrow = <<"END";
|
$versioninfo = "<small>$version</small>";
|
<tr>
|
|
<td colspan="2" align="left">
|
|
<small>$version</small>
|
|
</td>
|
|
</tr>
|
|
END
|
|
}
|
}
|
|
|
$r->print(<<ENDDOCUMENT);
|
$r->print(<<ENDDOCUMENT);
|
|
<div class="LC_landmark" role="contentinfo">
|
<div style="float: left;">
|
<div style="float: left;">
|
<table border="0" cellspacing="0" cellpadding="0">
|
<table border="0" cellspacing="0" cellpadding="0">
|
$domainrow
|
$domainrow
|
$serverrow
|
$serverrow
|
$loadrow
|
$loadrow
|
$userloadrow
|
$userloadrow
|
$versionrow
|
|
</table>
|
</table>
|
|
$versioninfo
|
</div>
|
</div>
|
<div style="float: right;">
|
<div style="float: right;">
|
$domainlogo
|
$domainlogo
|
</div>
|
</div>
|
|
</div>
|
<br style="clear:both;" />
|
<br style="clear:both;" />
|
</div>
|
</div>
|
|
|
|
$in_frame_js
|
<script type="text/javascript">
|
<script type="text/javascript">
|
// <![CDATA[
|
// <![CDATA[
|
// the if prevents the script error if the browser can not handle this
|
// the if prevents the script error if the browser can not handle this
|
Line 1090 sub redirect_page {
|
Line 1319 sub redirect_page {
|
$path = '/'.$path;
|
$path = '/'.$path;
|
}
|
}
|
my $url = $protocol.'://'.$hostname.$path;
|
my $url = $protocol.'://'.$hostname.$path;
|
if ($env{'form.firsturl'} ne '') {
|
my $args = {};
|
|
if ($env{'form.firsturl'} =~ m{^/tiny/$match_domain/\w+$}) {
|
|
$url = $protocol.'://'.$hostname.$env{'form.firsturl'};
|
|
if (($env{'form.ltoken'}) || ($env{'form.linkprot'} ne '') ||
|
|
($env{'form.linkkey'} ne '')) {
|
|
my %link_info;
|
|
if ($env{'form.ltoken'}) {
|
|
%link_info = &Apache::lonnet::tmpget($env{'form.ltoken'});
|
|
&Apache::lonnet::tmpdel($env{'form.ltoken'});
|
|
$args->{'only_body'} = 1;
|
|
} elsif ($env{'form.linkprot'}) {
|
|
$link_info{'linkprot'} = $env{'form.linkprot'};
|
|
foreach my $item ('linkprotuser','linkprotexit','linkprotpbid','linkprotpburl') {
|
|
if ($env{'form.'.$item}) {
|
|
$link_info{$item} = $env{'form.'.$item};
|
|
}
|
|
}
|
|
$args->{'only_body'} = 1;
|
|
} elsif ($env{'form.linkkey'} ne '') {
|
|
$link_info{'linkkey'} = $env{'form.linkkey'};
|
|
}
|
|
my $token = &Apache::lonnet::tmpput(\%link_info,$desthost,'link');
|
|
unless (($token eq 'con_lost') || ($token eq 'refused') ||
|
|
($token eq 'unknown_cmd') || ($token eq 'no_such_host')) {
|
|
$url .= '?ltoken='.$token;
|
|
}
|
|
}
|
|
} else {
|
my $querystring;
|
my $querystring;
|
if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
|
if ($env{'form.firsturl'} ne '') {
|
$querystring = &uri_escape_utf8($env{'form.firsturl'});
|
if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
|
} else {
|
$querystring = &uri_escape_utf8($env{'form.firsturl'});
|
$querystring = &uri_escape($env{'form.firsturl'});
|
} else {
|
|
$querystring = &uri_escape($env{'form.firsturl'});
|
|
}
|
|
$querystring = &HTML::Entities::encode($querystring,"'");
|
|
$querystring = '?firsturl='.$querystring;
|
}
|
}
|
$querystring = &HTML::Entities::encode($querystring,"'");
|
|
$url .='?firsturl='.$querystring;
|
|
}
|
|
if (($env{'form.ltoken'}) || ($env{'form.linkkey'} ne '')) {
|
|
my %link_info;
|
|
if ($env{'form.ltoken'}) {
|
if ($env{'form.ltoken'}) {
|
$link_info{'ltoken'} = $env{'form.ltoken'};
|
my %link_info = &Apache::lonnet::tmpget($env{'form.ltoken'});
|
} elsif ($env{'form.linkkey'} ne '') {
|
&Apache::lonnet::tmpdel($env{'form.ltoken'});
|
$link_info{'linkkey'} = $env{'form.linkkey'};
|
my $token = &Apache::lonnet::tmpput(\%link_info,$desthost,'link');
|
}
|
unless (($token eq 'con_lost') || ($token eq 'refused') || ($token =~ /^error:/) ||
|
my $token = &Apache::lonnet::tmpput(\%link_info,$desthost,'link');
|
($token eq 'unknown_cmd') || ($token eq 'no_such_host')) {
|
unless (($token eq 'con_lost') || ($token eq 'refused') ||
|
unless (($path eq '/adm/roles') || ($path eq '/adm/login')) {
|
($token eq 'unknown_cmd') || ($token eq 'no_such_host')) {
|
$url = $protocol.'://'.$hostname.'/adm/roles';
|
$url .= (($url=~/\?/)?'&':'?') . 'ttoken='.$token;
|
}
|
|
$querystring .= (($querystring =~/^\?/)?'&':'?') . 'ttoken='.$token;
|
|
}
|
}
|
}
|
|
$url .= $querystring;
|
}
|
}
|
my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
|
$args->{'redirect'} = [0,$url,'','',1];
|
{'redirect' => [0,$url],});
|
my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,$args);
|
my $end_page = &Apache::loncommon::end_page();
|
my $end_page = &Apache::loncommon::end_page();
|
return $start_page.$end_page;
|
return $start_page.$end_page;
|
}
|
}
|
Line 1140 sub contactdisplay {
|
Line 1398 sub contactdisplay {
|
}
|
}
|
}
|
}
|
if ($servadm && $showadminmail) {
|
if ($servadm && $showadminmail) {
|
$contactblock .= $$lt{'servadm'}.':<br />'.
|
$contactblock = '<div class="LC_login_links">'.$lt->{'servadm'}.':<br />'.
|
'<tt>'.$servadm.'</tt><br />';
|
'<tt>'.$servadm.'</tt></div>';
|
}
|
}
|
if ($showhelpdesk) {
|
if ($showhelpdesk) {
|
$contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';
|
$contactblock .= '<div class="LC_login_links">'.
|
|
'<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a></div>';
|
my $thisurl = &escape('/adm/login');
|
my $thisurl = &escape('/adm/login');
|
$$helpdeskscript = <<"ENDSCRIPT";
|
$$helpdeskscript = <<"ENDSCRIPT";
|
<script type="text/javascript">
|
<script type="text/javascript">
|