--- loncom/interface/resetpw.pm 2019/04/26 20:22:18 1.45
+++ loncom/interface/resetpw.pm 2025/02/14 22:42:05 1.53
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Allow access to password changing via a token sent to user's e-mail.
#
-# $Id: resetpw.pm,v 1.45 2019/04/26 20:22:18 raeburn Exp $
+# $Id: resetpw.pm,v 1.53 2025/02/14 22:42:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -115,6 +115,7 @@ sub handler {
}
}
my %passwdconf = &Apache::lonnet::get_passwdconf($dom_in_effect);
+ my $clientip = &Apache::lonnet::get_requestor_ip($r);
my $token = $env{'form.token'};
my $useremail = $env{'form.useremail'};
if (($udom ne '') && (!$otherinst) && (!$token)) {
@@ -288,24 +289,25 @@ END
$js.= "\n".''."\n";
}
my $header = &Apache::loncommon::start_page('Reset password',$js,$args).
- '
'.&mt('Reset forgotten LON-CAPA password').'
';
+ ''.
+ '
'.&mt('Reset forgotten LON-CAPA password').'
';
my $output;
if ($token) {
- $r->print($header);
- &reset_passwd($r,$token,$contact_name,$contact_email,\%passwdconf);
- $r->print(&Apache::loncommon::end_page());
+ $r->print($header.'');
+ &reset_passwd($r,$token,$contact_name,$contact_email,$clientip,\%passwdconf);
+ $r->print('
'.&Apache::loncommon::end_page());
return OK;
} elsif ($udom) {
if (!$domdesc) {
$output = &invalid_state('baddomain',$domdesc,
$contact_name,$contact_email);
} elsif ($otherinst) {
- ($header,$output) = &homeserver_redirect($uname,$udom,$domdesc,$brcrum);
+ ($header,$output) = &homeserver_redirect($r,$uname,$udom,$domdesc,$brcrum);
} elsif (($uname) || ($useremail)) {
my $earlyout;
unless ($passwdconf{'captcha'} eq 'unused') {
my ($captcha_chk,$captcha_error) =
- &Apache::loncommon::captcha_response('passwords',$server);
+ &Apache::loncommon::captcha_response('passwords',$server,$dom_in_effect);
if ($captcha_chk != 1) {
my $error = 'captcha';
if ($passwdconf{'captcha'} eq 'recaptcha') {
@@ -327,7 +329,7 @@ END
my $authtype = &Apache::lonnet::queryauthenticate($uname,$udom);
if ($authtype =~ /^internal/) {
my ($blocked,$blocktext) =
- &Apache::loncommon::blocking_status('passwd',$uname,$udom);
+ &Apache::loncommon::blocking_status('passwd',$clientip,$uname,$udom);
if ($blocked) {
$output = ''.$blocktext.'
'
.&display_actions($contact_email,$domdesc);
@@ -359,7 +361,7 @@ END
}
foreach my $item (@items) {
if ($item =~ /^[^\@]+\@[^\@]+\.[^\@\.]+$/) {
- unless (grep(/^\Q$item\E$/i,@allemails)) {
+ unless (grep(/^\Q$item\E$/i,@allemails)) {
push(@allemails,$item);
}
}
@@ -417,7 +419,7 @@ END
} else {
$output = &get_uname($server,$defdom,\%passwdconf);
}
- $r->print($header.$output);
+ $r->print($header.''.$output.'
');
$r->print(&Apache::loncommon::end_page());
return OK;
}
@@ -441,21 +443,21 @@ sub get_uname {
$msg .= $contents;
}
}
- $msg .= ''.&mt('Three conditions must be met:')
+ $msg .= '
'.&mt('Three conditions must be met:').'
'
.'- '.&mt('An e-mail address must have previously been associated with your LON-CAPA username.').'
'
.'- '.&mt('You must be able to access e-mail sent to that address.').'
'
.'- '.&mt('Your LON-CAPA account must be of a type for which LON-CAPA can reset a password.')
- .'
';
+ .'';
my $onchange = 'javascript:verifyDomain(this,this.form);';
$msg .= '