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
This commit is contained in:
Jeremy Shipman 2007-08-08 04:34:12 +00:00
parent d521b06a8c
commit 3a805afecf

View File

@ -120,7 +120,11 @@ class PageCommentInterface_Form extends Form {
//check if spam question was right. //check if spam question was right.
if(MathSpamProtection::isEnabled()){ if(MathSpamProtection::isEnabled()){
if(!MathSpamProtection::correctAnswer($data['Math'])){ if(!MathSpamProtection::correctAnswer($data['Math'])){
echo "<div class='BlogError'><p>You got the spam protection question wrong.</p></div>"; if(Director::is_ajax()) {
echo "<div class='BlogError'><p>You got the spam protection question wrong.</p></div>";
} else {
Director::redirectBack();
}
return; return;
} }
} }