mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
Add reCaptcha as default implementation
Add support for enabling and disabling captcha
This commit is contained in:
parent
f82f024fb7
commit
773d164256
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,7 +4,7 @@ wisemapping.ipr
|
||||
wisemapping.iws
|
||||
wisemapping.iml
|
||||
wisemapping.ids
|
||||
wise-webapp/wisemapping.log*
|
||||
*/wisemapping.log*
|
||||
*/.DS_Store
|
||||
.DS_Store
|
||||
target
|
||||
|
@ -193,12 +193,6 @@
|
||||
<version>1.0.1B</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.octo.captcha</groupId>
|
||||
<artifactId>jcaptcha</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
@ -308,6 +302,17 @@
|
||||
<version>2.10.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.tanesha.recaptcha4j</groupId>
|
||||
<artifactId>recaptcha4j</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.controller;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.Controller;
|
||||
|
||||
import com.octo.captcha.service.image.ImageCaptchaService;
|
||||
|
||||
import com.sun.image.codec.jpeg.JPEGCodec;
|
||||
import com.sun.image.codec.jpeg.JPEGImageEncoder;
|
||||
|
||||
public class CaptchaController
|
||||
implements Controller, InitializingBean
|
||||
{
|
||||
private ImageCaptchaService captchaService;
|
||||
|
||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
|
||||
byte[] captchaChallengeAsJpeg;
|
||||
// the output stream to render the captcha image as jpeg into
|
||||
final ByteArrayOutputStream jpegOutputStream = new ByteArrayOutputStream();
|
||||
|
||||
// get the session id that will identify the generated captcha.
|
||||
//the same id must be used to validate the response, the session id is a good candidate!
|
||||
final String captchaId = request.getSession().getId();
|
||||
|
||||
// call the ImageCaptchaService getChallenge method
|
||||
final BufferedImage challenge = captchaService.getImageChallengeForID(captchaId,request.getLocale());
|
||||
|
||||
// a jpeg encoder
|
||||
final JPEGImageEncoder jpegEncoder = JPEGCodec.createJPEGEncoder(jpegOutputStream);
|
||||
jpegEncoder.encode(challenge);
|
||||
|
||||
captchaChallengeAsJpeg = jpegOutputStream.toByteArray();
|
||||
|
||||
// flush it in the response
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
response.setContentType("image/jpeg");
|
||||
final ServletOutputStream responseOutputStream = response.getOutputStream();
|
||||
responseOutputStream.write(captchaChallengeAsJpeg);
|
||||
responseOutputStream.flush();
|
||||
responseOutputStream.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Set captcha service
|
||||
* @param captchaService The captchaService to set.
|
||||
*/
|
||||
public void setCaptchaService(ImageCaptchaService captchaService) {
|
||||
this.captchaService = captchaService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
public void afterPropertiesSet()
|
||||
throws Exception
|
||||
{
|
||||
if(captchaService == null){
|
||||
throw new RuntimeException("captcha service wasn`t set!");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.controller;
|
||||
|
||||
import com.octo.captcha.service.CaptchaServiceException;
|
||||
import com.octo.captcha.service.image.ImageCaptchaService;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.web.servlet.mvc.SimpleFormController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* Convenient superclass for form controller implementations which need
|
||||
* CAPTCHA support.
|
||||
*/
|
||||
public class CaptchaFormController extends SimpleFormController {
|
||||
/**
|
||||
* Default paramter name for CAPTCHA response in <code>{@link HttpServletRequest}</code>
|
||||
*/
|
||||
private static final String DEFAULT_CAPTCHA_RESPONSE_PARAMETER_NAME = "j_captcha_response";
|
||||
|
||||
protected ImageCaptchaService captchaService;
|
||||
protected String captchaResponseParameterName = DEFAULT_CAPTCHA_RESPONSE_PARAMETER_NAME;
|
||||
|
||||
/**
|
||||
* Delegates request to CAPTCHA validation, subclasses which overrides this
|
||||
* method must manually call <code>{@link #validateCaptcha(HttpServletRequest,BindException)}</code>
|
||||
* or explicitly call super method.
|
||||
*
|
||||
* @see #validateCaptcha(HttpServletRequest,BindException)
|
||||
* @see org.springframework.web.servlet.mvc.BaseCommandController#onBindAndValidate(javax.servlet.http.HttpServletRequest,java.lang.Object,org.springframework.validation.BindException)
|
||||
*/
|
||||
@Override
|
||||
protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors) throws Exception {
|
||||
validateCaptcha(request, errors);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate CAPTCHA response, if response isn`t valid creates new error object
|
||||
* and put him to errors holder.
|
||||
*
|
||||
* @param request current servlet request
|
||||
* @param errors errors holder
|
||||
*/
|
||||
protected void validateCaptcha(HttpServletRequest request, BindException errors) {
|
||||
boolean isResponseCorrect = false;
|
||||
|
||||
//remenber that we need an id to validate!
|
||||
String captchaId = request.getSession().getId();
|
||||
//retrieve the response
|
||||
String response = request.getParameter(captchaResponseParameterName);
|
||||
//validate response
|
||||
try {
|
||||
if (response != null) {
|
||||
isResponseCorrect =
|
||||
captchaService.validateResponseForID(captchaId, response);
|
||||
}
|
||||
} catch (CaptchaServiceException e) {
|
||||
//should not happen, may be thrown if the id is not valid
|
||||
}
|
||||
|
||||
if (!isResponseCorrect) {
|
||||
//prepare object error, captcha response isn`t valid
|
||||
// String objectName = "Captcha";
|
||||
// String[] codes = {"invalid"};
|
||||
// Object[] arguments = {};
|
||||
// String defaultMessage = "Wrong control text!";
|
||||
// ObjectError oe = new ObjectError(objectName, codes, arguments, defaultMessage);
|
||||
//
|
||||
// errors.addError(oe);
|
||||
errors.rejectValue("captcha", Messages.CAPTCHA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set captcha service
|
||||
*
|
||||
* @param captchaService the captchaService to set.
|
||||
*/
|
||||
public void setCaptchaService(ImageCaptchaService captchaService) {
|
||||
this.captchaService = captchaService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set paramter name for CAPTCHA response in <code>{@link HttpServletRequest}</code>
|
||||
*
|
||||
* @param captchaResponseParameterName the captchaResponseParameterName to set.
|
||||
*/
|
||||
public void setCaptchaResponseParameterName(String captchaResponseParameterName) {
|
||||
this.captchaResponseParameterName = captchaResponseParameterName;
|
||||
}
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.controller;
|
||||
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.service.UserService;
|
||||
import com.wisemapping.view.UserBean;
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class UserController
|
||||
extends CaptchaFormController {
|
||||
|
||||
//~ Instance fields ......................................................................................
|
||||
|
||||
private boolean emailConfirmEnabled;
|
||||
private UserService userService;
|
||||
|
||||
//~ Methods ..............................................................................................
|
||||
|
||||
|
||||
public boolean isEmailConfirmEnabled() {
|
||||
return emailConfirmEnabled;
|
||||
}
|
||||
|
||||
public void setEmailConfirmEnabled(boolean emailConfirmEnabled) {
|
||||
this.emailConfirmEnabled = emailConfirmEnabled;
|
||||
}
|
||||
|
||||
public ModelAndView onSubmit(Object command) throws WiseMappingException {
|
||||
final UserBean userBean = ((UserBean) command);
|
||||
|
||||
if (userBean != null) {
|
||||
final User user = new User();
|
||||
// trim() the email email in order to remove spaces
|
||||
user.setEmail(userBean.getEmail().trim());
|
||||
user.setUsername(userBean.getUsername());
|
||||
user.setFirstname(userBean.getFirstname());
|
||||
user.setLastname(userBean.getLastname());
|
||||
user.setPassword(userBean.getPassword());
|
||||
userService.createUser(user,emailConfirmEnabled);
|
||||
}
|
||||
|
||||
final Map<String,Object> model = new HashMap<String,Object>();
|
||||
model.put("confirmByEmail",emailConfirmEnabled);
|
||||
return new ModelAndView(getSuccessView(),model);
|
||||
}
|
||||
|
||||
public void setUserService(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.controller;
|
||||
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.service.UserService;
|
||||
import com.wisemapping.view.UserBean;
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import net.tanesha.recaptcha.ReCaptcha;
|
||||
import net.tanesha.recaptcha.ReCaptchaResponse;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
public class UserRegistrationController
|
||||
extends BaseSimpleFormController {
|
||||
|
||||
//~ Instance fields ......................................................................................
|
||||
|
||||
private boolean emailConfirmEnabled;
|
||||
private UserService userService;
|
||||
private ReCaptcha captchaService;
|
||||
private boolean captchaEnabled;
|
||||
|
||||
//~ Methods ..............................................................................................
|
||||
|
||||
|
||||
public boolean isEmailConfirmEnabled() {
|
||||
return emailConfirmEnabled;
|
||||
}
|
||||
|
||||
public void setEmailConfirmEnabled(boolean emailConfirmEnabled) {
|
||||
this.emailConfirmEnabled = emailConfirmEnabled;
|
||||
}
|
||||
|
||||
public ModelAndView onSubmit(@Nullable Object command) throws WiseMappingException {
|
||||
final UserBean userBean = ((UserBean) command);
|
||||
|
||||
if (userBean != null) {
|
||||
final User user = new User();
|
||||
// trim() the email email in order to remove spaces
|
||||
user.setEmail(userBean.getEmail().trim());
|
||||
user.setUsername(userBean.getUsername());
|
||||
user.setFirstname(userBean.getFirstname());
|
||||
user.setLastname(userBean.getLastname());
|
||||
user.setPassword(userBean.getPassword());
|
||||
userService.createUser(user, emailConfirmEnabled);
|
||||
}
|
||||
|
||||
final Map<String, Object> model = new HashMap<String, Object>();
|
||||
model.put("confirmByEmail", emailConfirmEnabled);
|
||||
return new ModelAndView(getSuccessView(), model);
|
||||
}
|
||||
|
||||
public void setUserService(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
public void setCaptchaService(@NotNull final ReCaptcha captchaService) {
|
||||
this.captchaService = captchaService;
|
||||
}
|
||||
|
||||
public ReCaptcha getCaptchaService() {
|
||||
return captchaService;
|
||||
}
|
||||
|
||||
public boolean isCaptchaEnabled() {
|
||||
return captchaEnabled;
|
||||
}
|
||||
|
||||
public void setCaptchaEnabled(boolean captchaEnabled) {
|
||||
this.captchaEnabled = captchaEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors) throws Exception {
|
||||
|
||||
super.onBindAndValidate(request, command, errors);
|
||||
// If captcha is enabled, generate it ...
|
||||
if (isCaptchaEnabled()) {
|
||||
|
||||
final String challenge = request.getParameter("recaptcha_challenge_field");
|
||||
final String uresponse = request.getParameter("recaptcha_response_field");
|
||||
|
||||
final String remoteAddr = request.getRemoteAddr();
|
||||
final ReCaptchaResponse reCaptchaResponse = captchaService.checkAnswer(remoteAddr, challenge, uresponse);
|
||||
if (!reCaptchaResponse.isValid()) {
|
||||
errors.rejectValue("captcha", Messages.CAPTCHA_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ModelAndView showForm(HttpServletRequest request, HttpServletResponse response, BindException bindException) throws Exception {
|
||||
final ModelAndView modelAndView = super.showForm(request, response, bindException);
|
||||
|
||||
// If captcha is enabled, generate it ...
|
||||
if (isCaptchaEnabled()) {
|
||||
final Properties prop = new Properties();
|
||||
prop.put("theme", "white");
|
||||
final String captchaHtml = captchaService.createRecaptchaHtml(null, prop);
|
||||
request.setAttribute("captchaHtml", captchaHtml);
|
||||
request.setAttribute("captchaEnabled", true);
|
||||
}
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
@ -107,12 +107,12 @@ public class User
|
||||
|
||||
final User user = (User) o;
|
||||
|
||||
if (!getEmail().equals(user.getEmail())) return false;
|
||||
final String email = getEmail();
|
||||
if (email != null ? !email.equals(user.getEmail()) : user.getEmail() != null) return false;
|
||||
if (firstname != null ? !firstname.equals(user.firstname) : user.firstname != null) return false;
|
||||
if (lastname != null ? !lastname.equals(user.lastname) : user.lastname != null) return false;
|
||||
if (username != null ? !username.equals(user.username) : user.username != null) return false;
|
||||
return !(username != null ? !username.equals(user.username) : user.username != null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
@ -120,7 +120,7 @@ public class User
|
||||
result = (firstname != null ? firstname.hashCode() : 0);
|
||||
result = 29 * result + (lastname != null ? lastname.hashCode() : 0);
|
||||
result = 29 * result + (password != null ? password.hashCode() : 0);
|
||||
result = 29 * result + getEmail().hashCode();
|
||||
result = 29 * result + (getEmail() != null ? getEmail().hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,9 @@ import com.wisemapping.controller.Messages;
|
||||
import com.wisemapping.service.UserService;
|
||||
import com.wisemapping.view.UserBean;
|
||||
import com.wisemapping.model.Constants;
|
||||
import net.tanesha.recaptcha.ReCaptcha;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.ValidationUtils;
|
||||
import org.springframework.validation.Validator;
|
||||
@ -30,12 +33,14 @@ public class UserValidator
|
||||
implements Validator {
|
||||
|
||||
private UserService userService;
|
||||
private ReCaptcha captchaService;
|
||||
|
||||
|
||||
public boolean supports(final Class clazz) {
|
||||
return clazz.equals(UserBean.class);
|
||||
}
|
||||
|
||||
public void validate(Object obj, Errors errors) {
|
||||
public void validate(@Nullable Object obj, @NotNull Errors errors) {
|
||||
UserBean user = (UserBean) obj;
|
||||
if (user == null) {
|
||||
errors.rejectValue("user", "error.not-specified");
|
||||
@ -100,4 +105,12 @@ public class UserValidator
|
||||
public void setUserService(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
public void setCaptchaService(@NotNull final ReCaptcha captchaService) {
|
||||
this.captchaService = captchaService;
|
||||
}
|
||||
|
||||
public ReCaptcha getCaptchaService() {
|
||||
return captchaService;
|
||||
}
|
||||
}
|
@ -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
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
@ -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'/>
|
||||
|
@ -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}"/>
|
||||
|
@ -1,19 +1,8 @@
|
||||
<%@ 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">
|
||||
<div id="userRegistration">
|
||||
<h1>
|
||||
<spring:message code="USER_REGISTRATION"/>
|
||||
</h1>
|
||||
@ -29,8 +18,7 @@
|
||||
<tr>
|
||||
<td class="formLabel">
|
||||
<span class="fieldRequired">*</span>
|
||||
<spring:message code="EMAIL"/>
|
||||
:
|
||||
<spring:message code="EMAIL"/>:
|
||||
</td>
|
||||
<td>
|
||||
<form:input path="email" id="email"/>
|
||||
@ -40,8 +28,7 @@
|
||||
<tr>
|
||||
<td class="formLabel">
|
||||
<span class="fieldRequired">*</span>
|
||||
<spring:message code="USERNAME"/>
|
||||
:
|
||||
<spring:message code="USERNAME"/>:
|
||||
</td>
|
||||
<td>
|
||||
<form:input path="username" id="username"/>
|
||||
@ -51,8 +38,7 @@
|
||||
<tr>
|
||||
<td class="formLabel">
|
||||
<span class="fieldRequired">*</span>
|
||||
<spring:message code="FIRSTNAME"/>
|
||||
:
|
||||
<spring:message code="FIRSTNAME"/>:
|
||||
</td>
|
||||
<td>
|
||||
<form:input path="firstname" id="firstname"/>
|
||||
@ -62,8 +48,7 @@
|
||||
<tr>
|
||||
<td class="formLabel">
|
||||
<span class="fieldRequired">*</span>
|
||||
<spring:message code="LASTNAME"/>
|
||||
:
|
||||
<spring:message code="LASTNAME"/>:
|
||||
</td>
|
||||
<td>
|
||||
<form:input path="lastname" id="lastname"/>
|
||||
@ -73,8 +58,7 @@
|
||||
<tr>
|
||||
<td class="formLabel">
|
||||
<span class="fieldRequired">*</span>
|
||||
<spring:message code="PASSWORD"/>
|
||||
:
|
||||
<spring:message code="PASSWORD"/>:
|
||||
</td>
|
||||
<td>
|
||||
<form:password path="password" id="password"/>
|
||||
@ -84,33 +68,26 @@
|
||||
<tr>
|
||||
<td class="formLabel">
|
||||
<span class="fieldRequired">*</span>
|
||||
<spring:message code="RETYPE_PASSWORD"/>
|
||||
:
|
||||
<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">
|
||||
<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"/>
|
||||
${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"/>
|
||||
@ -127,7 +104,8 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="submit" value="<spring:message code="REGISTER"/>" id="submitButton" class="btn-primary">
|
||||
<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>
|
||||
|
Loading…
Reference in New Issue
Block a user