Passwords: Make it possible for plugins to enforce extra password strength / validity rules during the reset process.

Adds a filter in the password reset process so that a plugin can enforce particular password rules on users to compliment the existing filtering in the Profile modification process.
Fixes #21778.


git-svn-id: http://core.svn.wordpress.org/trunk@21923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Westwood 2012-09-20 11:01:29 +00:00
parent fa8a509ff3
commit e1b861e1cb
1 changed files with 7 additions and 4 deletions

View File

@ -459,11 +459,14 @@ case 'rp' :
exit;
}
$errors = '';
$errors = new WP_Error();
if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] ) {
$errors = new WP_Error('password_reset_mismatch', __('The passwords do not match.'));
} elseif ( isset($_POST['pass1']) && !empty($_POST['pass1']) ) {
if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] )
$errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) );
do_action( 'validate_password_reset', $errors, $user );
if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) {
reset_password($user, $_POST['pass1']);
login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' );
login_footer();