--- loncom/interface/resetpw.pm 2013/02/01 17:39:22 1.29 +++ loncom/interface/resetpw.pm 2013/08/14 16:47:37 1.35 @@ -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.29 2013/02/01 17:39:22 bisitz Exp $ +# $Id: resetpw.pm,v 1.35 2013/08/14 16:47:37 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('

'.&mt('Reset forgotten LON-CAPA password').'

'); + $r->print('

'.&mt('Reset forgotten LON-CAPA password').'

'); my $output; if ($token) { $output = &reset_passwd($r,$token,$contact_name,$contact_email); @@ -177,8 +173,8 @@ sub handler { sub get_uname { my ($defdom) = @_; my %lt = &Apache::lonlocal::texthash( - unam => 'username', - udom => 'domain', + unam => 'LON-CAPA username', + udom => 'LON-CAPA domain', uemail => 'E-mail address in LON-CAPA', proc => 'Proceed'); @@ -190,10 +186,10 @@ sub get_uname { .''; $msg .= '
'. &Apache::lonhtmlcommon::start_pick_box(). - &Apache::lonhtmlcommon::row_title('LON-CAPA '.$lt{'unam'}). + &Apache::lonhtmlcommon::row_title($lt{'unam'}). ''. &Apache::lonhtmlcommon::row_closure(1). - &Apache::lonhtmlcommon::row_title('LON-CAPA '.$lt{'udom'}). + &Apache::lonhtmlcommon::row_title($lt{'udom'}). &Apache::loncommon::select_dom_form($defdom,'udom'). &Apache::lonhtmlcommon::row_closure(1). &Apache::lonhtmlcommon::row_title($lt{'uemail'}). @@ -229,7 +225,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.

The link included in the message will be valid for the next two hours."); + $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.') + .'

' + .&mt('The link included in the message will be valid for the next [_1]two[_2] hours.','',''); } else { $msg .= '

' @@ -237,7 +236,6 @@ sub send_token { .' associated with your LON-CAPA account.') .'

' .&display_actions($contact_email,$domdesc); - } } else { $msg .= @@ -328,23 +326,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('Go to the login page').'.'; + $msg .= + &Apache::loncommon::confirmwrapper($confirm_msg) + .&Apache::lonhtmlcommon::actionbox([ + ''.&mt('Go to the login page').'']); } elsif ($change_failed eq 'invalid_client') { my $homeserver = &Apache::lonnet::homeserver($data{'username'},$data{'domain'}); if ($homeserver eq 'no_host') { @@ -429,19 +428,19 @@ sub display_actions { '','')); my $msg2 = ''; if ($contact_email ne '') { - my $escuri = &HTML::Entities::encode('/adm/resetpw','&<>"'); - push(@msg, &mt('Contact the [_1]LON-CAPA helpdesk[_2] for the institution: [_3]', - '', - '',''.$domdesc.'')); - } else { - $msg2 = - '

' - .&mt('You may wish to send an e-mail to the' - .' server administrator: [_1] for the [_2] domain.', - ''.$Apache::lonnet::perlvar{'AdminEmail'}.'', - ''.$domdesc.'') - .'

'; - } + my $escuri = &HTML::Entities::encode('/adm/resetpw','&<>"'); + push(@msg, &mt('Contact the [_1]LON-CAPA helpdesk[_2] for the institution: [_3]', + '', + '',''.$domdesc.'')); + } else { + $msg2 = + '

' + .&mt('You may wish to send an e-mail to the' + .' server administrator: [_1] for the [_2] domain.', + ''.$Apache::lonnet::perlvar{'AdmEMail'}.'', + ''.$domdesc.'') + .'

'; + } return &Apache::lonhtmlcommon::actionbox(\@msg).$msg2;