Add reCaptcha as default implementation

Add support for enabling and disabling captcha
This commit is contained in:
Paulo Gustavo Veiga
2012-03-21 23:30:07 -03:00
parent f82f024fb7
commit 773d164256
14 changed files with 321 additions and 469 deletions

View File

@@ -44,6 +44,7 @@ database.password=
#------------------------
# GMAIL SMTP Configuration
#------------------------
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.port=587
mail.smtp.auth = true
mail.host=smtp.gmail.com
@@ -54,19 +55,28 @@ mail.smtp.starttls.enable=true
#------------------------
# Domain address
#------------------------
mail.registrationEmail=root@localhost
mail.siteEmail=root@localhost
##################################################################################
# Users Registration Configuration
##################################################################################
# Enable/Disable user registration confirmation by e-mail. If it's enabled, mail must be configured.
registration.email.enabled = false
# Enable captcha confirmation
registration.recaptcha.enabled = false
# ReCaptcha is the default captcha. Public and private keys are required.
# More Info: http://www.google.com/recaptcha
registration.recaptcha.privateKey =
registration.recaptcha.publicKey =
##################################################################################
# Site configuration
##################################################################################
# Enable/Disable user registration confirmation by e-mail. If it's enabled, mail must be configured.
user.confirm.registration=false
# Site administration user. This user will have special permissions for operations such as removing users, set password
# etc.
admin.user = admin@wisemapping.org

View File

@@ -1,6 +1,6 @@
log4j.rootLogger=WARN, stdout, R
log4j.logger.com.wisemapping=WARN,stdout,R
log4j.logger.org.springframework=DEBUG,stdout,R
log4j.logger.org.springframework=WARN,stdout,R
log4j.logger.org.codehaus.jackson=WARN,stdout,R
# Stdout logger <20>

View File

@@ -116,10 +116,10 @@
<bean id="userValidator" class="com.wisemapping.validator.UserValidator">
<property name="userService" ref="userService"/>
<property name="captchaService" ref="reCaptcha"/>
</bean>
<bean id="userController" class="com.wisemapping.controller.UserController">
<!--<property name="captchaService" ref="captchaService"/>-->
<bean id="userController" class="com.wisemapping.controller.UserRegistrationController">
<property name="sessionForm" value="false"/>
<property name="commandName" value="user"/>
<property name="commandClass" value="com.wisemapping.view.UserBean"/>
@@ -127,7 +127,9 @@
<property name="formView" value="userRegistration"/>
<property name="successView" value="userRegistrationConfirmation"/>
<property name="userService" ref="userService"/>
<property name="emailConfirmEnabled" value="${user.confirm.registration}"/>
<property name="emailConfirmEnabled" value="${registration.email.enabled}"/>
<property name="captchaEnabled" value="${registration.recaptcha.enabled}"/>
<property name="captchaService" ref="reCaptcha"/>
</bean>
<bean id="forgotPasswordValidator" class="com.wisemapping.validator.ForgotPasswordValidator"/>
@@ -275,10 +277,6 @@
<property name="mindmapService" ref="mindmapService"/>
</bean>
<!--<bean id="captchaController" class="com.wisemapping.controller.CaptchaController">-->
<!--<property name="captchaService" ref="captchaService"/>-->
<!--</bean>-->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
<list>
@@ -337,5 +335,9 @@
<property name="paramName" value="language"/>
</bean>
<bean id="reCaptcha" class="net.tanesha.recaptcha.ReCaptchaImpl">
<property name="privateKey" value="${registration.recaptcha.privateKey}"/>
<property name="publicKey" value="${registration.recaptcha.publicKey}"/>
<property name="includeNoscript" value="false"/>
</bean>
</beans>

View File

@@ -48,8 +48,7 @@
</c:if>
<tr>
<td class="formLabel">
<spring:message code="EMAIL"/>
:
<spring:message code="EMAIL"/>:
</td>
<td>
<input type='text' tabindex="1" id="email" name='j_username'/>
@@ -57,8 +56,7 @@
</tr>
<tr>
<td class="formLabel">
<spring:message code="PASSWORD"/>
:
<spring:message code="PASSWORD"/>:
</td>
<td>
<input type='password' tabindex="2" id="password" name='j_password'/>

View File

@@ -1,19 +1,6 @@
<%@ include file="/jsp/init.jsp" %>
<%--@elvariable id="wisemapDetail" type="com.wisemapping.view.MindMapBean"--%>
<script type="text/javascript">
if(typeof isOldIE != "undefined"){
window.onload = function() {
var boxGenerator = RUZEE.ShadedBorder.create({ corner:16, border:1 });
boxGenerator.render('detailContent');
boxGenerator.render('detail');
};
}
MOOdalBox.reloadRequered = true;
</script>
<c:url value="mymaps.htm" var="shareMap">
<c:param name="action" value="collaborator"/>
<c:param name="userEmail" value="${pageContext.request.userPrincipal.name}"/>

View File

@@ -1,139 +1,117 @@
<%@ include file="/jsp/init.jsp" %>
<script type="text/javascript">
if(typeof isOldIE != "undefined"){
window.onload = function() {
var simpleButtonGenerator = RUZEE.ShadedBorder.create({ corner:8, border:1 });
simpleButtonGenerator.render('userRegistration');
$('submitButton').addEvent('click', displayLoading);
};
}
</script>
<div id="userRegistrationContent">
<div id="userRegistration" class="sb">
<h1>
<spring:message code="USER_REGISTRATION"/>
</h1>
<div id="userRegistration">
<h1>
<spring:message code="USER_REGISTRATION"/>
</h1>
<h2>
<spring:message code="REGISTRATION_TITLE_MSG"/>
<br/><br/>
<spring:message code="FIELD_REQUIRED_MSG"/>
</h2>
<form:form method="post" commandName="user">
<table>
<tbody>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="EMAIL"/>
:
</td>
<td>
<form:input path="email" id="email"/>
<form:errors path="email" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="USERNAME"/>
:
</td>
<td>
<form:input path="username" id="username"/>
<form:errors path="username" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="FIRSTNAME"/>
:
</td>
<td>
<form:input path="firstname" id="firstname"/>
<form:errors path="firstname" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="LASTNAME"/>
:
</td>
<td>
<form:input path="lastname" id="lastname"/>
<form:errors path="lastname" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="PASSWORD"/>
:
</td>
<td>
<form:password path="password" id="password"/>
<form:errors path="password" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="RETYPE_PASSWORD"/>
:
</td>
<td>
<form:password path="retypePassword" id="retypePassword"/>
<form:errors path="retypePassword" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="WORD_VERIFICATION"/>
:
</td>
<td>
<p>
<spring:message code="TYPE_CHARACTER_BELOW"/>
</p>
<img src="captcha.htm"/><br/>
<input type="text" name="j_captcha_response"/><br/>
<form:errors path="captcha" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<spring:message code="TERM_OF_THE_SERVICE"/>
:
</td>
<td>
<spring:message code="WISEMAPPING_ACCOUNT_MESSAGE"/>
<a href="termsOfUse.htm">
<spring:message code="HERE"/>
</a>.<br/>
</td>
</tr>
<tr>
<td class="formLabel">&nbsp;</td>
<td>
<spring:message code="REGISTRATION_CLICK_ADVICE"/>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="<spring:message code="REGISTER"/>" id="submitButton" class="btn-primary">
<input type="button" value="<spring:message code="CANCEL"/>"
onclick="window.location='<c:url value="mymaps.htm"/>'" class="btn-secondary">
</td>
</tr>
</tbody>
</table>
</form:form>
</div>
<h2>
<spring:message code="REGISTRATION_TITLE_MSG"/>
<br/><br/>
<spring:message code="FIELD_REQUIRED_MSG"/>
</h2>
<form:form method="post" commandName="user">
<table>
<tbody>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="EMAIL"/>:
</td>
<td>
<form:input path="email" id="email"/>
<form:errors path="email" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="USERNAME"/>:
</td>
<td>
<form:input path="username" id="username"/>
<form:errors path="username" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="FIRSTNAME"/>:
</td>
<td>
<form:input path="firstname" id="firstname"/>
<form:errors path="firstname" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="LASTNAME"/>:
</td>
<td>
<form:input path="lastname" id="lastname"/>
<form:errors path="lastname" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="PASSWORD"/>:
</td>
<td>
<form:password path="password" id="password"/>
<form:errors path="password" cssClass="errorMsg"/>
</td>
</tr>
<tr>
<td class="formLabel">
<span class="fieldRequired">*</span>
<spring:message code="RETYPE_PASSWORD"/>:
</td>
<td>
<form:password path="retypePassword" id="retypePassword"/>
<form:errors path="retypePassword" cssClass="errorMsg"/>
</td>
</tr>
<c:if test="${requestScope.captchaEnabled}">
<tr>
<td class="formLabel">
</td>
<td>
<form:errors path="captcha" cssClass="errorMsg"/>
${requestScope.captchaHtml}
</td>
</tr>
</c:if>
<tr>
<td class="formLabel">
<spring:message code="TERM_OF_THE_SERVICE"/>
</td>
<td>
<spring:message code="WISEMAPPING_ACCOUNT_MESSAGE"/>
<a href="termsOfUse.htm">
<spring:message code="HERE"/>
</a>.<br/>
</td>
</tr>
<tr>
<td class="formLabel">&nbsp;</td>
<td>
<spring:message code="REGISTRATION_CLICK_ADVICE"/>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="<spring:message code="REGISTER"/>" id="submitButton"
class="btn-primary">
<input type="button" value="<spring:message code="CANCEL"/>"
onclick="window.location='<c:url value="mymaps.htm"/>'" class="btn-secondary">
</td>
</tr>
</tbody>
</table>
</form:form>
</div>
</div>