--- loncom/interface/resetpw.pm 2013/03/25 16:33:08 1.32 +++ loncom/interface/resetpw.pm 2016/01/27 00:24:09 1.37 @@ -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.32 2013/03/25 16:33:08 bisitz Exp $ +# $Id: resetpw.pm,v 1.37 2016/01/27 00:24:09 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -91,13 +91,10 @@ sub handler { my $udom = $env{'form.udom'}; my $token = $env{'form.token'}; my $brcrum = []; - my $bread_crumbs_component = 'Forgotten Password'; if ($token) { push (@{$brcrum}, {href => '/adm/resetpw', text => 'Update Password'}); - - $bread_crumbs_component = 'Reset Password'; } else { push (@{$brcrum}, {href => '/adm/resetpw', @@ -108,10 +105,9 @@ sub handler { text => 'Result'}); } } - my $args = {bread_crumbs => $brcrum, - bread_crumbs_component => $bread_crumbs_component}; + my $args = {bread_crumbs => $brcrum}; $r->print(&Apache::loncommon::start_page('Reset password','',$args)); - $r->print('
'.$blocktext.'
' + .&display_actions($contact_email,$domdesc); + } elsif ($useremail !~ /^[^\@]+\@[^\@]+\.[^\@\.]+$/) { + $output = &invalid_state('baduseremail',$domdesc, + $contact_name,$contact_email); } else { my %userinfo = &Apache::lonnet::get('environment',\@emailtypes, @@ -229,7 +230,10 @@ sub send_token { my $result = &send_mail($domdesc,$email,$mailmsg,$contact_name, $contact_email); if ($result eq 'ok') { - $msg .= &mt("An e-mail sent to the e-mail address associated with your LON-CAPA account includes the web address for the link you should use to complete the reset process.' @@ -237,7 +241,6 @@ sub send_token { .' associated with your LON-CAPA account.') .'
' .&display_actions($contact_email,$domdesc); - } } else { $msg .= @@ -312,7 +315,12 @@ sub reset_passwd { ($data{'email'} =~ /^[^\@]+\@[^\@]+\.[^\@\.]+$/) && ($data{'temppasswd'} =~/^\w+$/)) { my $reqtime = &Apache::lonlocal::locallocaltime($data{'time'}); - if ($now - $data{'time'} < 7200) { + my ($blocked,$blocktext) = + &Apache::loncommon::blocking_status('passwd',$data{'username'},$data{'domain'}); + if ($blocked) { + $msg = ''.$blocktext.'
'; + return $msg; + } elsif ($now - $data{'time'} < 7200) { if ($env{'form.action'} eq 'verify_and_change_pass') { unless (($env{'form.uname'} eq $data{'username'}) && ($env{'form.udom'} eq $data{'domain'}) && ($env{'form.email'} eq $data{'email'})) { $msg = &generic_failure_msg($contact_name,$contact_email); @@ -328,23 +336,24 @@ sub reset_passwd { my $mailmsg = &mt('The password for your LON-CAPA account in the [_1] domain was changed [_2] from IP address: [_3]. If you did not perform this change or authorize it, please contact the [_4] ([_5]).',$domdesc,$now,$ENV{'REMOTE_ADDR'},$contact_name,$contact_email)."\n"; my $result = &send_mail($domdesc,$data{'email'},$mailmsg, $contact_name,$contact_email); + my $confirm_msg; if ($result eq 'ok') { - $msg .= - '' - .&mt('An e-mail confirming setting of the password' - .' for your LON-CAPA account has been sent to [_1].' - ,$data{'email'}) - .'
'; + $confirm_msg = + &Apache::lonhtmlcommon::confirm_success( + &mt('An e-mail confirming setting of the password' + .' for your LON-CAPA account has been sent to [_1].' + ,''.$data{'email'}.'')); } else { - $msg .= - '' - .&mt('An error occurred when sending e-mail to [_1]' - .' confirming setting of your new password.' - ,$data{'email'}) - .'
'; + $confirm_msg = + &Apache::lonhtmlcommon::confirm_success( + &mt('An error occurred when sending e-mail to [_1]' + .' confirming setting of your new password.' + ,''.$data{'email'}.''),1); } - $msg .= ''
.&mt('A problem occurred when attempting to reset the password for your account.')
.'
'
- .&mt('Please contact the [_1] - ([_2]) for assistance.',
+ .&mt('Please contact the [_1] ([_2]) for assistance.',
$contact_name,''.$contact_email.'')
.'