Form validation for password resets.

Merges [30417] to the 4.0 branch.

Built from https://develop.svn.wordpress.org/branches/4.0@30418


git-svn-id: http://core.svn.wordpress.org/branches/4.0@30413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-11-20 12:23:33 +00:00
parent 432912f7e9
commit 133bfe6a23
1 changed files with 4 additions and 0 deletions

View File

@ -571,6 +571,9 @@ case 'rp' :
if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) { if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 ); list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
$user = check_password_reset_key( $rp_key, $rp_login ); $user = check_password_reset_key( $rp_key, $rp_login );
if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) {
$user = false;
}
} else { } else {
$user = false; $user = false;
} }
@ -640,6 +643,7 @@ case 'rp' :
*/ */
do_action( 'resetpass_form', $user ); do_action( 'resetpass_form', $user );
?> ?>
<input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" />
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Reset Password'); ?>" /></p> <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Reset Password'); ?>" /></p>
</form> </form>