');
+ if ($saml_landing) {
+ $ssoauthstyle = 'inline-block';
+ $stdauthformstyle = 'none';
+ $logintype = $samlssotext;
+ my $ssologin = '/adm/sso';
+ if ($samlssourl ne '') {
+ $ssologin = $samlssourl;
+ }
+ if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
+ my $querystring;
+ if ($env{'form.firsturl'} ne '') {
+ $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,"'");
+ }
+ if ($querystring ne '') {
+ $ssologin .= (($ssologin=~/\?/)?'&':'?') . $querystring;
+ }
+ } elsif ($logtoken ne '') {
+ $ssologin .= (($ssologin=~/\?/)?'&':'?') . 'logtoken='.$logtoken;
+ }
+ my $ssohref;
+ if ($samlssoimg ne '') {
+ $ssohref = '
!['.$samlssoalt.']('.$samlssoimg.')
';
+ } else {
+ $ssohref = '
'.$samlssotext.'';
+ }
+ if (($env{'form.saml'} eq 'no') ||
+ (($env{'form.username'} ne '') && ($env{'form.domain'} ne ''))) {
+ $ssoauthstyle = 'none';
+ $stdauthformstyle = 'inline-block';
+ $logintype = $samlnonsso;
+ }
+ $r->print(<
+Log-in type:
+$logintype
+$lt{'change'}
+
+
+
+$ssohref
+$noscript_warning
+
+
+$loginhelp
+$contactblock
+$coursecatalog
+
+
+ENDSAML
+ }
+
+ $r->print(<
$logintitle
$loginform
@@ -640,8 +777,8 @@ HEADER
-'."\n");
if ($showmainlogo) {
$r->print('
![]('.$logo.')
'."\n");
}
@@ -746,7 +883,7 @@ sub check_loginvia {
my $output;
if ($loginvia ne '') {
my $noredirect;
- my $ip = $ENV{'REMOTE_ADDR'};
+ my $ip = &Apache::lonnet::get_requestor_ip();
if ($ip eq '127.0.0.1') {
$noredirect = 1;
} else {
@@ -814,7 +951,14 @@ sub redirect_page {
}
my $url = $protocol.'://'.$hostname.$path;
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;
}
my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
{'redirect' => [0,$url],});
@@ -890,5 +1034,19 @@ sub newuser_link {
return '
'.$linkname.'';
}
+sub decode_token {
+ my ($info) = @_;
+ my ($firsturl,@rest)=split(/\&/,$info);
+ my %form;
+ if ($firsturl ne '') {
+ $form{'firsturl'} = &unescape($firsturl);
+ }
+ foreach my $item (@rest) {
+ my ($key,$value) = split(/=/,$item);
+ $form{$key} = &unescape($value);
+ }
+ return %form;
+}
+
1;
__END__