[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface loncommon.pm
raeburn
raeburn at source.lon-capa.org
Sun Jan 3 22:42:19 EST 2021
raeburn Mon Jan 4 03:42:19 2021 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface loncommon.pm
Log:
- For 2.11
Backport 1.1350 (modified)
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1075.2.149 loncom/interface/loncommon.pm:1.1075.2.150
--- loncom/interface/loncommon.pm:1.1075.2.149 Thu Nov 12 01:18:26 2020
+++ loncom/interface/loncommon.pm Mon Jan 4 03:42:19 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1075.2.149 2020/11/12 01:18:26 raeburn Exp $
+# $Id: loncommon.pm,v 1.1075.2.150 2021/01/04 03:42:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5105,7 +5105,8 @@
($ENV{'REMOTE_ADDR'} eq &Apache::lonnet::get_host_ip($Apache::lonnet::perlvar{'lonHostID'}))) {
$ip = $env{'request.host'} || $ENV{'REMOTE_ADDR'} || $clientip;
} else {
- $ip = $ENV{'REMOTE_ADDR'} || $env{'request.host'} || $clientip;
+ my $remote_ip = &Apache::lonnet::get_requestor_ip();
+ $ip = $remote_ip || $env{'request.host'} || $clientip;
}
my $name;
@@ -15885,6 +15886,7 @@
# --------------------------------------------------------- Write first profile
{
+ my $ip = &Apache::lonnet::get_requestor_ip();
my %initial_env =
("user.name" => $username,
"user.domain" => $domain,
@@ -15903,7 +15905,7 @@
"request.course.sec" => '',
"request.role" => 'cm',
"request.role.adv" => $env{'user.adv'},
- "request.host" => $ENV{'REMOTE_ADDR'},);
+ "request.host" => $ip,);
if ($form->{'localpath'}) {
$initial_env{"browser.localpath"} = $form->{'localpath'};
@@ -17149,13 +17151,14 @@
sub check_recaptcha {
my ($privkey,$version) = @_;
my $captcha_chk;
+ my $ip = &Apache::lonnet::get_requestor_ip();
if ($version >= 2) {
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
my %info = (
secret => $privkey,
response => $env{'form.g-recaptcha-response'},
- remoteip => $ENV{'REMOTE_ADDR'},
+ remoteip => $ip,
);
my $response = $ua->post('https://www.google.com/recaptcha/api/siteverify',\%info);
if ($response->is_success) {
@@ -17171,7 +17174,7 @@
my $captcha_result =
$captcha->check_answer(
$privkey,
- $ENV{'REMOTE_ADDR'},
+ $ip,
$env{'form.recaptcha_challenge_field'},
$env{'form.recaptcha_response_field'},
);
More information about the LON-CAPA-cvs
mailing list