Commit:    583d2c1b39a8b88960ab94e56ba4a4608ddb2353
Author:    Hannes Magnusson <[email protected]>         Sat, 21 Feb 2015 
12:15:03 -0800
Parents:   fbb772f57bcd96b5c334926f7ebb0949fe12c6af
Branches:  master

Link:       
http://git.php.net/?p=web/wiki.git;a=commitdiff;h=583d2c1b39a8b88960ab94e56ba4a4608ddb2353

Log:
Customize the spam challenge

Changed paths:
  M  dokuwiki/inc/auth.php
  M  dokuwiki/inc/html.php


Diff:
diff --git a/dokuwiki/inc/auth.php b/dokuwiki/inc/auth.php
index 4b1e6ce..8fa8ef7 100644
--- a/dokuwiki/inc/auth.php
+++ b/dokuwiki/inc/auth.php
@@ -962,11 +962,12 @@ function register() {
     // gather input
     $login    = trim($auth->cleanUser($INPUT->post->str('login')));
     $fullname = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '', 
$INPUT->post->str('fullname')));
+    $spam     = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '', 
$INPUT->post->str('spam')));
     $email    = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '', 
$INPUT->post->str('email')));
     $pass     = $INPUT->post->str('pass');
     $passchk  = $INPUT->post->str('passchk');
 
-    if(empty($login) || empty($fullname) || empty($email)) {
+    if(empty($login) || empty($fullname) || empty($email) || empty($spam)) {
         msg($lang['regmissing'], -1);
         return false;
     }
@@ -987,6 +988,12 @@ function register() {
         return false;
     }
 
+    // make sure the secret spam box was filled out correctly
+    if($spam != "[email protected]") {
+        msg("That wasn't the answer we were expecting",-1);
+        return false;
+    }
+
     //okay try to create the user
     if(!$auth->triggerUserMod('create', array($login, $pass, $fullname, 
$email))) {
         msg($lang['reguexists'], -1);
diff --git a/dokuwiki/inc/html.php b/dokuwiki/inc/html.php
index 495bdf9..cd418ea 100644
--- a/dokuwiki/inc/html.php
+++ b/dokuwiki/inc/html.php
@@ -1591,6 +1591,7 @@ function html_register(){
     }
     $form->addElement(form_makeTextField('fullname', 
$INPUT->post->str('fullname'), $lang['fullname'], '', 'block', $base_attrs));
     $form->addElement(form_makeField('email','email', 
$INPUT->post->str('email'), $lang['email'], '', 'block', $email_attrs));
+    $form->addElement(form_makeTextField('spam', $_POST['spam'], "Which email 
address do you have to mail now?", '', 'block', array('size'=>'50')));
     $form->addElement(form_makeButton('submit', '', $lang['btn_register']));
     $form->endFieldset();
     html_form('register', $form);


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to