From 3a805afecf424378b7f7e13efdf37cb1a49b8bf6 Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Wed, 8 Aug 2007 04:34:12 +0000 Subject: [PATCH] Changed spam protection so that user is redirected back to comment form if they get the question wrong and don't use javascript. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@39735 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/sitefeatures/PageCommentInterface.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/sitefeatures/PageCommentInterface.php b/code/sitefeatures/PageCommentInterface.php index db8bda03..8de0bdc6 100755 --- a/code/sitefeatures/PageCommentInterface.php +++ b/code/sitefeatures/PageCommentInterface.php @@ -120,7 +120,11 @@ class PageCommentInterface_Form extends Form { //check if spam question was right. if(MathSpamProtection::isEnabled()){ if(!MathSpamProtection::correctAnswer($data['Math'])){ - echo "

You got the spam protection question wrong.

"; + if(Director::is_ajax()) { + echo "

You got the spam protection question wrong.

"; + } else { + Director::redirectBack(); + } return; } }