Index: core/xwiki-core/pom.xml
===================================================================
--- core/xwiki-core/pom.xml (revision 26266)
+++ core/xwiki-core/pom.xml (working copy)
@@ -124,15 +124,7 @@
1.0a7
-
- jcaptcha
- jcaptcha-all
- 1.0-RC3
-
-
- com.novell.ldapjldap4.3
Index: core/xwiki-core/src/main/java/com/xpn/xwiki/plugin/captcha/CaptchaPlugin.java
===================================================================
--- core/xwiki-core/src/main/java/com/xpn/xwiki/plugin/captcha/CaptchaPlugin.java (revision 26291)
+++ core/xwiki-core/src/main/java/com/xpn/xwiki/plugin/captcha/CaptchaPlugin.java (working copy)
@@ -1,163 +0,0 @@
-/*
- * See the NOTICE file distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- */
-package com.xpn.xwiki.plugin.captcha;
-
-import com.octo.captcha.module.config.CaptchaModuleConfigHelper;
-import com.octo.captcha.module.struts.CaptchaServicePlugin;
-import com.octo.captcha.service.CaptchaService;
-import com.octo.captcha.service.CaptchaServiceException;
-import com.xpn.xwiki.XWikiContext;
-import com.xpn.xwiki.XWikiException;
-import com.xpn.xwiki.api.Api;
-import com.xpn.xwiki.plugin.XWikiDefaultPlugin;
-import com.xpn.xwiki.plugin.XWikiPluginInterface;
-import com.xpn.xwiki.user.api.XWikiRightService;
-import com.xpn.xwiki.web.XWikiRequest;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class CaptchaPlugin extends XWikiDefaultPlugin
-{
- private static Log mLogger =
- LogFactory.getLog(com.xpn.xwiki.plugin.captcha.CaptchaPlugin.class);
-
- public CaptchaPlugin(String name, String className, XWikiContext context)
- {
- super(name, className, context);
- init(context);
- }
-
- public String getName()
- {
- return "jcaptcha";
- }
-
- public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context)
- {
- return new CaptchaPluginApi((CaptchaPlugin) plugin, context);
- }
-
- public void flushCache()
- {
- }
-
- public void init(XWikiContext context)
- {
- super.init(context);
- }
-
- public String displayCaptcha(String action, String classname, XWikiContext context)
- throws XWikiException
- {
- StringBuffer output = new StringBuffer();
- String user = context.getUser();
- String actionuser = "";
- if (user.equals(XWikiRightService.GUEST_USER_FULLNAME)) {
- actionuser = action + "_anonymous";
- } else if (user.equals("XWiki.Admin")) {
- return ""; // not captcha with admin
- } else {
- actionuser = action + "_registered";
- }
-
- String typecaptcha = context.getWiki().getWebPreference(actionuser, context);
-
- output.append("
");
- if (typecaptcha.equalsIgnoreCase("image")) {
- output.append(
- "
");
- output.append("
Enter the code shown :
");
- output.append(
- "
");
- output.append(
- "
");
- output.append("
");
- output.append("
");
- output.append("
");
- } else if (typecaptcha.equalsIgnoreCase("text")) {
- int term1 = (int) Math.floor(Math.random() * 100);
- int term2 = (int) Math.floor(Math.random() * 100);
- int sum = term1 + term2;
- output.append("Please answer this simple math question: ");
- output.append(term1 + " + " + term2 + " = ");
- output.append("");
- output.append("");
- }
- output.append("
");
-
- return output.toString();
- }
-
- public Boolean verifyCaptcha(String action, XWikiContext context) throws XWikiException
- {
- String user = context.getUser();
- String actionuser;
- if (user.equals(XWikiRightService.GUEST_USER_FULLNAME)) {
- actionuser = action + "_anonymous";
- } else if (user.equals("XWiki.Admin")) {
- return Boolean.TRUE; // If is admin then return TRUE for confirm captcha
- } else {
- actionuser = action + "_registered";
- }
- String typecaptcha = context.getWiki().getWebPreference(actionuser, context);
-
- XWikiRequest request = context.getRequest();
- Boolean isResponseCorrect = Boolean.FALSE;
- if (typecaptcha.equalsIgnoreCase("image")) {
- CaptchaService service = CaptchaServicePlugin.getInstance().getService();
- String responseKey = CaptchaServicePlugin.getInstance().getResponseKey();
- String captchaID = CaptchaModuleConfigHelper.getId(request);
- String challengeResponse = request.getParameter(responseKey);
- request.removeAttribute(responseKey);
- if (challengeResponse != null) {
- try {
- isResponseCorrect = service.validateResponseForID(captchaID, challengeResponse);
- } catch (CaptchaServiceException e) {
- request.setAttribute(CaptchaServicePlugin.getInstance().getMessageKey(),
- CaptchaModuleConfigHelper.getMessage(request));
- }
- } else {
- isResponseCorrect = Boolean.TRUE;
- }
- } else if (typecaptcha.equalsIgnoreCase("text")) {
- String sum = request.getParameter("sum_result");
- String sum_answer = request.getParameter("sum_answer");
- if ((sum != null) && (sum_answer != null)) {
- try {
- if (Integer.parseInt(sum) == Integer.parseInt(sum_answer)) {
- isResponseCorrect = Boolean.TRUE;
- }
- } catch (NumberFormatException e) {
- isResponseCorrect = Boolean.FALSE;
- }
- } else {
- isResponseCorrect = Boolean.TRUE;
- }
- } else {
- isResponseCorrect = Boolean.TRUE;
- }
-
- return isResponseCorrect;
- }
-}
Index: core/xwiki-core/src/main/java/com/xpn/xwiki/plugin/captcha/CaptchaPluginApi.java
===================================================================
--- core/xwiki-core/src/main/java/com/xpn/xwiki/plugin/captcha/CaptchaPluginApi.java (revision 26291)
+++ core/xwiki-core/src/main/java/com/xpn/xwiki/plugin/captcha/CaptchaPluginApi.java (working copy)
@@ -1,59 +0,0 @@
-/*
- * See the NOTICE file distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- */
-package com.xpn.xwiki.plugin.captcha;
-
-import com.xpn.xwiki.XWikiContext;
-import com.xpn.xwiki.XWikiException;
-import com.xpn.xwiki.api.Api;
-
-public class CaptchaPluginApi extends Api
-{
- private CaptchaPlugin plugin;
-
- public CaptchaPluginApi(CaptchaPlugin plugin, XWikiContext context)
- {
- super(context);
- setPlugin(plugin);
- }
-
- public CaptchaPlugin getPlugin()
- {
- if (hasProgrammingRights()) {
- return plugin;
- }
- return null;
- }
-
- private void setPlugin(CaptchaPlugin plugin)
- {
- this.plugin = plugin;
- }
-
- public String displayCaptcha(String action, String classname) throws XWikiException
- {
- return plugin.displayCaptcha(action, classname, getXWikiContext());
- }
-
- public Boolean verifyCaptcha(String action) throws XWikiException
- {
- return plugin.verifyCaptcha(action, getXWikiContext());
- }
-}
Index: pom/pom.xml
===================================================================
--- pom/pom.xml (revision 26266)
+++ pom/pom.xml (working copy)
@@ -276,7 +276,6 @@
com.xpn.xwiki.plugin.charts.ChartingPlugin,\
com.xpn.xwiki.plugin.fileupload.FileUploadPlugin,\
com.xpn.xwiki.plugin.image.ImagePlugin,\
- com.xpn.xwiki.plugin.captcha.CaptchaPlugin,\
com.xpn.xwiki.plugin.userdirectory.UserDirectoryPlugin,\
com.xpn.xwiki.plugin.usertools.XWikiUserManagementToolsImpl,\
com.xpn.xwiki.plugin.zipexplorer.ZipExplorerPlugin,\
Index: web/standard/src/main/webapp/WEB-INF/struts-config.xml
===================================================================
--- web/standard/src/main/webapp/WEB-INF/struts-config.xml (revision 26266)
+++ web/standard/src/main/webapp/WEB-INF/struts-config.xml (working copy)
@@ -402,10 +402,6 @@
-
-
-