mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-23 07:51:49 +01:00
Fire the check_admin_referer
action on failure as well as success.
This enables things like logging nonce failures in the admin. props markjaquith. fixes #32207. Built from https://develop.svn.wordpress.org/trunk@33017 git-svn-id: http://core.svn.wordpress.org/trunk@32988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8eb7f71e6b
commit
275bff1895
@ -1091,10 +1091,6 @@ function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
|
|||||||
$adminurl = strtolower(admin_url());
|
$adminurl = strtolower(admin_url());
|
||||||
$referer = strtolower(wp_get_referer());
|
$referer = strtolower(wp_get_referer());
|
||||||
$result = isset($_REQUEST[$query_arg]) ? wp_verify_nonce($_REQUEST[$query_arg], $action) : false;
|
$result = isset($_REQUEST[$query_arg]) ? wp_verify_nonce($_REQUEST[$query_arg], $action) : false;
|
||||||
if ( !$result && !(-1 == $action && strpos($referer, $adminurl) === 0) ) {
|
|
||||||
wp_nonce_ays($action);
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires once the admin request has been validated or not.
|
* Fires once the admin request has been validated or not.
|
||||||
@ -1106,6 +1102,12 @@ function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
|
|||||||
* 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
|
* 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
|
||||||
*/
|
*/
|
||||||
do_action( 'check_admin_referer', $action, $result );
|
do_action( 'check_admin_referer', $action, $result );
|
||||||
|
|
||||||
|
if ( ! $result && ! ( -1 == $action && strpos( $referer, $adminurl ) === 0 ) ) {
|
||||||
|
wp_nonce_ays( $action );
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.3-alpha-33016';
|
$wp_version = '4.3-alpha-33017';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user