--- loncom/interface/lonpreferences.pm 2019/04/24 02:00:23 1.229 +++ loncom/interface/lonpreferences.pm 2019/08/21 22:41:13 1.235 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.229 2019/04/24 02:00:23 raeburn Exp $ +# $Id: lonpreferences.pm,v 1.235 2019/08/21 22:41:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -27,8 +27,6 @@ # # This package uses the "londes.js" javascript code. # -# TODOs that have to be completed: -# interface with lonnet to change the password package Apache::lonpreferences; @@ -365,7 +363,7 @@ $options.' &Apache::lonhtmlcommon::row_closure(1). &Apache::lonhtmlcommon::end_pick_box().' '); - if ($roles_check_list) { + if ($roles_check_list) { $r->print('

'.&mt('Freeze Roles').'

'.&mt('The table below can be used to [_1]freeze[_2] '.$lc_role.'s in the Hotlist.','','').'
'. @@ -1312,7 +1310,7 @@ sub passwordchanger { ); return; } - } else { + } else { $r->print( '

' .&mt('Sorry, the URL generated when you requested reset of' @@ -1410,7 +1408,7 @@ sub jscript_send { |; } if ((ref($extrafields) eq 'HASH') && ($extrafields->{'email'})) { - $output .= qq| + $output .= qq| this.document.pserver.elements.email.value = this.document.client.elements.email.value; |; @@ -1446,7 +1444,7 @@ sub client_form { .&Apache::lonhtmlcommon::row_closure(); } if ((ref($extrafields) eq 'HASH') && ($extrafields->{'username'})) { - $output .= &Apache::lonhtmlcommon::row_title( + $output .= &Apache::lonhtmlcommon::row_title( '') .'' .&Apache::lonhtmlcommon::row_closure() @@ -1621,7 +1619,7 @@ ENDERROR &mt('Please try again.').'',$caller,$mailtoken); return 1; } - } + } if ($newpass1 ne $newpass2) { &passwordchanger($r, ''. @@ -1629,12 +1627,23 @@ ENDERROR &mt('Please try again.').'',$caller,$mailtoken); return 1; } - if (length($newpass1) < 7) { - &passwordchanger($r, - ''. - &mt('Passwords must be a minimum of 7 characters long.').' '. - &mt('Please try again.').'',$caller,$mailtoken); - return 1; + if ($currentauth eq 'unix:') { + if (length($newpass1) < 7) { + &passwordchanger($r, + ''. + &mt('Passwords must be a minimum of 7 characters long.').' '. + &mt('Please try again.').'',$caller,$mailtoken); + return 1; + } + } else { + my $warning = &Apache::loncommon::check_passwd_rules($domain,$newpass1); + if ($warning) { + &passwordchanger($r,''. + $warning. + &mt('Please try again.').'', + $caller,$mailtoken); + return 1; + } } # # Check for bad characters @@ -1682,8 +1691,14 @@ ENDERROR return $result; } } else { + my $feedback; + if ($result eq 'prioruse') { + $feedback = &mt('Please enter a password that you have not used recently.'); + } else { + $feedback = &mt('Please make sure your old password was entered correctly.'); + } $message = &Apache::lonhtmlcommon::confirm_success( - &mt("The password for user [_1] was not changed.",''.$user.'').' '.&mt('Please make sure your old password was entered correctly.'),1); + &mt("The password for user [_1] was not changed.",''.$user.'').' '.$feedback,1); $message=&Apache::loncommon::confirmwrapper($message); &print_main_menu($r, $message); if (ref($ended)) { @@ -2291,7 +2306,7 @@ sub handler { } else { $brlink ='/adm/preferences'; $brtxt = 'Set User Preferences'; - $brhelp = 'Prefs_About_Me,Prefs_Language,Prefs_Screen_Name_Nickname,Change_Colors,Change_Password,Prefs_Messages,Change_Discussion_Display'; + $brhelp = 'Prefs_About_Me,Prefs_Language,Prefs_Screen_Name_Nickname,Change_Colors,Change_Password,Prefs_Messages,Change_Discussion_Display'; } Apache::lonhtmlcommon::add_breadcrumb ({href => $brlink,