This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen_1.x. See https://gitlab.nuiton.org/None/pollen_1.x.git commit 3fc0d79aab1c9cd988d694e010d48c7a07c3e3ec Author: Eric Chatellier <eric.chatellier@gmail.com> Date: Wed Nov 18 22:22:19 2015 +0100 fixes #1301: [Comment] Add anti spam filter vote vote and comments --- .../chorem/pollen/ui/actions/poll/vote/AddComment.java | 17 +++++++++++++++++ .../src/main/webapp/WEB-INF/jsp/poll/vote.jsp | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AddComment.java b/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AddComment.java index c823a69..b2eebfc 100644 --- a/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AddComment.java +++ b/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AddComment.java @@ -44,6 +44,8 @@ public class AddComment extends AbstractVoteAction implements Preparable { */ private String commentText; + protected String commentUrl; + public void setCommentText(String commentText) { this.commentText = commentText; } @@ -51,6 +53,14 @@ public class AddComment extends AbstractVoteAction implements Preparable { public String getCommentText() { return commentText; } + + public String getCommentUrl() { + return commentUrl; + } + + public void setCommentUrl(String commentUrl) { + this.commentUrl = commentUrl; + } @Override public boolean isModerate() { @@ -74,6 +84,13 @@ public class AddComment extends AbstractVoteAction implements Preparable { if (StringUtils.isBlank(getCommentText())) { addFieldError("commentText", _("pollen.error.comment.text.empty")); } + + // comment url field is present in form but NOT displayed to user + // if a value is filled, this should a spam robot that try to fill all field + // reject actin in this case + if (StringUtils.isNotBlank(commentUrl)) { + addActionError(t("pollen.error.comment.spam")); + } } @InputConfig(methodName = PREPARE_VOTE_PAGE) diff --git a/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp b/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp index 0d55c93..40a5bd8 100644 --- a/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp +++ b/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp @@ -4,7 +4,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit + Copyright (C) 2009 - 2015 CodeLutin, Tony Chemit, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by @@ -396,6 +396,9 @@ <s:textfield key="commentAuthor" requiredLabel="true" size="78" label="%{getText('pollen.common.commentAuthor')}"/> + <%-- anti spam field --%> + <input type="text" name="commentUrl" class="hidden" /> + <s:url var="configUrl" value='/js/ckeditor.config.js'/> <sjr:ckeditor key="commentText" requiredLabel="true" value="" rows="3" cols="54" width="500" -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.