summaryrefslogtreecommitdiffstats
path: root/wp-includes/wpmu-functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-07-04 17:11:55 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-07-04 17:11:55 +0000
commit9f31c4ced9504d2142a035f96e05c00b59db104d (patch)
tree202f12f2d62422e1323eb21783ca286bed53257f /wp-includes/wpmu-functions.php
parentb7f49ba2b09704054013e87bdddca4ac085bcb43 (diff)
downloadwordpress-mu-9f31c4ced9504d2142a035f96e05c00b59db104d.tar.gz
wordpress-mu-9f31c4ced9504d2142a035f96e05c00b59db104d.tar.xz
wordpress-mu-9f31c4ced9504d2142a035f96e05c00b59db104d.zip
Experimental signup nonce
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1353 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/wpmu-functions.php')
-rw-r--r--wp-includes/wpmu-functions.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php
index 4812b10..8f73360 100644
--- a/wp-includes/wpmu-functions.php
+++ b/wp-includes/wpmu-functions.php
@@ -1922,4 +1922,19 @@ function mu_locale( $locale ) {
}
add_filter( 'locale', 'mu_locale' );
+function signup_nonce_fields() {
+ $id = mt_rand();
+ echo "<input type='hidden' name='signup_form_id' value='{$id}' />";
+ wp_nonce_field('signup_form_' . $id, '_signup_form', false);
+}
+add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
+
+function signup_nonce_check( $result ) {
+ if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] )
+ wp_die( 'Please try again!' );
+
+ return $result;
+}
+add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
+add_filter( 'wpmu_validate_user_signup', 'signup_nonce_check' );
?>