From 4234ca7e386f38d8340e18932589a1d7be2ce175 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Fri, 14 Sep 2018 17:50:27 -0700 Subject: [PATCH] Upgrade Spring version. Fix failing export tests --- distribution/docker-conf/app.properties | 6 +- pom.xml | 4 +- wise-webapp/pom.xml | 33 ++++--- .../wisemapping/exporter/ExporterFactory.java | 4 + .../rest/TransformerController.java | 6 +- .../wisemapping/service/RecaptchaService.java | 92 +++++++++++++++++++ .../com/wisemapping/validator/Messages.java | 1 - .../wisemapping/validator/UserValidator.java | 8 +- .../wisemapping/webmvc/UsersController.java | 75 +++++++-------- .../src/main/resources/messages_ca.properties | 1 - .../src/main/resources/messages_de.properties | 1 - .../src/main/resources/messages_en.properties | 1 - .../src/main/resources/messages_es.properties | 1 - .../src/main/resources/messages_fr.properties | 1 - .../src/main/resources/messages_it.properties | 1 - .../main/resources/messages_pt_BR.properties | 1 - .../main/resources/messages_zh_CN.properties | 1 - .../main/resources/messages_zh_TW.properties | 1 - .../src/main/webapp/WEB-INF/app.properties | 6 +- .../webapp/WEB-INF/classes/log4j.properties | 13 +-- .../src/main/webapp/WEB-INF/heroku.properties | 62 ------------- .../WEB-INF/wisemapping-security-db.xml | 2 +- .../WEB-INF/wisemapping-security-ldap.xml | 2 +- .../webapp/WEB-INF/wisemapping-security.xml | 2 +- .../webapp/WEB-INF/wisemapping-service.xml | 4 + .../webapp/WEB-INF/wisemapping-servlet.xml | 6 -- wise-webapp/src/main/webapp/jsp/template.jsp | 3 +- .../src/main/webapp/jsp/userRegistration.jsp | 8 +- .../src/test/resources/data/svg/bug-nbsp.svg | 2 +- .../src/test/resources/data/svg/bug1.svg | 2 +- 30 files changed, 187 insertions(+), 163 deletions(-) create mode 100644 wise-webapp/src/main/java/com/wisemapping/service/RecaptchaService.java delete mode 100644 wise-webapp/src/main/webapp/WEB-INF/heroku.properties diff --git a/distribution/docker-conf/app.properties b/distribution/docker-conf/app.properties index 8928c4b0..db8ada22 100644 --- a/distribution/docker-conf/app.properties +++ b/distribution/docker-conf/app.properties @@ -65,12 +65,12 @@ mail.errorReporterEmail= ################################################################################## # Enable captcha confirmation -google.recaptcha.enabled = true +google.recaptcha2.enabled = true # ReCaptcha is the default captcha. Public and private keys are required. # More Info: http://www.google.com/recaptcha . -google.recaptcha.privateKey = 6LeQ4tISAAAAAMfHMPRKyHupTfA-KE4QeTCnLXhK -google.recaptcha.publicKey = 6LeQ4tISAAAAALzCGKNgRv8UqsDx7Cb0vq4wbJBr +google.recaptcha2.siteKey = 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI +google.recaptcha2.secretKey = 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe ################################################################################## # Site configuration diff --git a/pom.xml b/pom.xml index ff8eda62..bb24c32d 100644 --- a/pom.xml +++ b/pom.xml @@ -119,8 +119,8 @@ maven-compiler-plugin 3.1 - 1.7 - 1.7 + 1.8 + 1.8 UTF-8 diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 4ff898ea..796efcab 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -110,7 +110,7 @@ org.slf4j slf4j-log4j12 - 1.7.2 + 1.7.25 runtime @@ -145,8 +145,14 @@ org.apache.tiles tiles-jsp - 2.1.4 + 2.2.2 runtime + + + org.slf4j + jcl-over-slf4j + + org.springframework @@ -280,7 +286,7 @@ org.slf4j slf4j-api - 1.7.2 + 1.7.25 runtime @@ -289,12 +295,6 @@ 2.10.0 compile - - net.tanesha.recaptcha4j - recaptcha4j - 0.0.7 - compile - org.jsoup @@ -316,7 +316,16 @@ jstl 1.2 - + + org.apache.httpcomponents + fluent-hc + 4.5.5 + + + org.apache.httpcomponents + httpclient + 4.5.5 + @@ -561,9 +570,9 @@ - org.mortbay.jetty + org.eclipse.jetty jetty-maven-plugin - 8.1.14.v20131031 + 9.4.12.v20180830 false foo diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java index ffdf8db7..a2ffd1f8 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java @@ -167,6 +167,10 @@ public class ExporterFactory { svgXml = svgXml.replaceFirst(" values = new HashMap(); if (content == null || content.length() == 0) { throw new IllegalArgumentException("Body can not be null."); @@ -53,7 +53,7 @@ public class TransformerController extends BaseController { @RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"image/svg+xml"}, consumes = {"image/svg+xml"}) @ResponseBody - public ModelAndView transformSvg(@RequestBody @Nullable final String content) throws IOException { + public ModelAndView transformSvg(@RequestBody @Nullable final String content) { final Map values = new HashMap(); if (content == null || content.length() == 0) { throw new IllegalArgumentException("Body can not be null."); @@ -65,7 +65,7 @@ public class TransformerController extends BaseController { @RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"image/png"}, consumes = {"image/svg+xml"}) @ResponseBody - public ModelAndView transformPng(@RequestBody @Nullable final String content) throws IOException { + public ModelAndView transformPng(@RequestBody @Nullable final String content) { final Map values = new HashMap(); if (content == null || content.length() == 0) { throw new IllegalArgumentException("Body can not be null."); diff --git a/wise-webapp/src/main/java/com/wisemapping/service/RecaptchaService.java b/wise-webapp/src/main/java/com/wisemapping/service/RecaptchaService.java new file mode 100644 index 00000000..c8a7f466 --- /dev/null +++ b/wise-webapp/src/main/java/com/wisemapping/service/RecaptchaService.java @@ -0,0 +1,92 @@ +package com.wisemapping.service; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.lang.StringUtils; +import org.apache.http.NameValuePair; +import org.apache.http.client.fluent.Form; +import org.apache.http.client.fluent.Request; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Value; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class RecaptchaService { + + final private static Logger logger = Logger.getLogger(RecaptchaService.class); + final private static String GOOGLE_RECAPTCHA_VERIFY_URL = + "https://www.google.com/recaptcha/api/siteverify"; + + private final static ObjectMapper objectMapper = new ObjectMapper(); + private String recaptchaSecret; + + public String verifyRecaptcha(String ip, String recaptchaResponse) { + + final List build = Form.form() + .add("secret", recaptchaSecret) + .add("response", recaptchaResponse) + .add("remoteip", ip) + .build(); + + // Add logs ... + logger.debug("Response from remoteip: " + ip); + logger.debug("Response from recaptchaSecret: " + recaptchaSecret); + logger.debug("Response from recaptchaResponse: " + recaptchaResponse); + + String result = StringUtils.EMPTY; + HashMap bodyJson; + try { + final byte[] body = Request + .Post(GOOGLE_RECAPTCHA_VERIFY_URL) + .bodyForm(build) + .execute() + .returnContent() + .asBytes(); + + bodyJson = objectMapper + .readValue(body, HashMap.class); + + logger.debug("Response from recaptcha after parse: " + bodyJson); + + final Boolean success = (Boolean) bodyJson.get("success"); + if (!success) { + final List errorCodes = (List) bodyJson + .get("error-codes"); + result = RecaptchaUtil.RECAPTCHA_ERROR_CODE.get(errorCodes.get(0)); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + result = e.getMessage(); + } + + logger.debug("Captcha Result:" + result); + return result; + + } + + public void setRecaptchaSecret(String recaptchaSecret) { + this.recaptchaSecret = recaptchaSecret; + } +} + +class RecaptchaUtil { + + static final Map + RECAPTCHA_ERROR_CODE = new HashMap<>(); + + static { + RECAPTCHA_ERROR_CODE.put("missing-input-secret", + "The secret parameter is missing"); + RECAPTCHA_ERROR_CODE.put("invalid-input-secret", + "The secret parameter is invalid or malformed"); + RECAPTCHA_ERROR_CODE.put("missing-input-response", + "The response parameter is missing"); + RECAPTCHA_ERROR_CODE.put("invalid-input-response", + "The response parameter is invalid or malformed"); + RECAPTCHA_ERROR_CODE.put("bad-request", + "The request is invalid or malformed"); + } +} \ No newline at end of file diff --git a/wise-webapp/src/main/java/com/wisemapping/validator/Messages.java b/wise-webapp/src/main/java/com/wisemapping/validator/Messages.java index da2a8c9d..f498bb1f 100644 --- a/wise-webapp/src/main/java/com/wisemapping/validator/Messages.java +++ b/wise-webapp/src/main/java/com/wisemapping/validator/Messages.java @@ -26,6 +26,5 @@ public interface Messages { String MAP_TITLE_ALREADY_EXISTS = "MAP_TITLE_ALREADY_EXISTS"; String LABEL_TITLE_ALREADY_EXISTS = "LABEL_TITLE_ALREADY_EXISTS"; String PASSWORD_MISSMATCH = "PASSWORD_MISSMATCH"; - String CAPTCHA_ERROR = "CAPTCHA_ERROR"; String CAPTCHA_LOADING_ERROR = "CAPTCHA_LOADING_ERROR"; } diff --git a/wise-webapp/src/main/java/com/wisemapping/validator/UserValidator.java b/wise-webapp/src/main/java/com/wisemapping/validator/UserValidator.java index 6914b83f..10fd1144 100644 --- a/wise-webapp/src/main/java/com/wisemapping/validator/UserValidator.java +++ b/wise-webapp/src/main/java/com/wisemapping/validator/UserValidator.java @@ -18,10 +18,10 @@ package com.wisemapping.validator; +import com.wisemapping.service.RecaptchaService; 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; @@ -32,7 +32,7 @@ public class UserValidator implements Validator { private UserService userService; - private ReCaptcha captchaService; + private RecaptchaService captchaService; public boolean supports(final Class clazz) { @@ -92,11 +92,11 @@ public class UserValidator this.userService = userService; } - public void setCaptchaService(@NotNull final ReCaptcha captchaService) { + public void setCaptchaService(@NotNull final RecaptchaService captchaService) { this.captchaService = captchaService; } - public ReCaptcha getCaptchaService() { + public RecaptchaService getCaptchaService() { return captchaService; } } \ No newline at end of file diff --git a/wise-webapp/src/main/java/com/wisemapping/webmvc/UsersController.java b/wise-webapp/src/main/java/com/wisemapping/webmvc/UsersController.java index 91903854..9b676164 100644 --- a/wise-webapp/src/main/java/com/wisemapping/webmvc/UsersController.java +++ b/wise-webapp/src/main/java/com/wisemapping/webmvc/UsersController.java @@ -1,36 +1,35 @@ /* -* Copyright [2015] [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. -*/ + * Copyright [2015] [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.webmvc; -import com.wisemapping.model.AuthenticationType; -import com.wisemapping.service.InvalidAuthSchemaException; -import com.wisemapping.validator.Messages; import com.wisemapping.exceptions.WiseMappingException; +import com.wisemapping.model.AuthenticationType; import com.wisemapping.model.User; import com.wisemapping.security.Utils; +import com.wisemapping.service.InvalidAuthSchemaException; import com.wisemapping.service.InvalidUserEmailException; +import com.wisemapping.service.RecaptchaService; import com.wisemapping.service.UserService; +import com.wisemapping.validator.Messages; import com.wisemapping.validator.UserValidator; import com.wisemapping.view.UserBean; -import net.tanesha.recaptcha.ReCaptcha; -import net.tanesha.recaptcha.ReCaptchaResponse; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -55,11 +54,13 @@ public class UsersController { private UserService userService; @Autowired - private ReCaptcha captchaService; + private RecaptchaService captchaService; - @Value("${google.recaptcha.enabled}") + @Value("${google.recaptcha2.enabled}") private boolean captchaEnabled; + @Value("${google.recaptcha2.siteKey}") + private String recaptchaSiteKey; @RequestMapping(value = "user/resetPassword", method = RequestMethod.GET) public ModelAndView showResetPasswordPage() { @@ -74,10 +75,7 @@ public class UsersController { userService.resetPassword(email); result = new ModelAndView("forgotPasswordSuccess"); - } catch (InvalidUserEmailException e) { - result = new ModelAndView("forgotPasswordError"); - } - catch (InvalidAuthSchemaException e) { + } catch (InvalidUserEmailException | InvalidAuthSchemaException e) { result = new ModelAndView("forgotPasswordError"); } return result; @@ -89,10 +87,8 @@ public class UsersController { // If captcha is enabled, generate it ... final Properties prop = new Properties(); prop.put("theme", "white"); - - final String captchaHtml = captchaService.createRecaptchaHtml(null, prop); - request.setAttribute("captchaHtml", captchaHtml); - request.setAttribute("captchaEnabled", true); + request.setAttribute("recaptchaSiteKey", recaptchaSiteKey); + request.setAttribute("recaptchaEnabled", true); } return new ModelAndView("userRegistration", "user", new UserBean()); } @@ -115,7 +111,7 @@ public class UsersController { boolean confirmRegistrationByEmail = false; user.setAuthenticationType(AuthenticationType.DATABASE); - userService.createUser(user, confirmRegistrationByEmail,true); + userService.createUser(user, confirmRegistrationByEmail, true); // Forward to the success view ... result = new ModelAndView("userRegistrationSuccess"); @@ -130,7 +126,7 @@ public class UsersController { return "accountSettings"; } - private BindingResult validateRegistrationForm(@NotNull UserBean userBean, @NotNull HttpServletRequest request, @NotNull BindingResult bindingResult) { + private void validateRegistrationForm(@NotNull UserBean userBean, @NotNull HttpServletRequest request, @NotNull BindingResult bindingResult) { final UserValidator userValidator = new UserValidator(); userValidator.setUserService(userService); userValidator.setCaptchaService(captchaService); @@ -138,21 +134,18 @@ public class UsersController { // If captcha is enabled, generate it ... if (captchaEnabled) { - final String challenge = request.getParameter("recaptcha_challenge_field"); - final String uresponse = request.getParameter("recaptcha_response_field"); + final String gReponse = request.getParameter("g-recaptcha-response"); - if (challenge != null && uresponse != null) { + if (gReponse != null) { final String remoteAddr = request.getRemoteAddr(); - final ReCaptchaResponse reCaptchaResponse = captchaService.checkAnswer(remoteAddr, challenge, uresponse); - - if (!reCaptchaResponse.isValid()) { - bindingResult.rejectValue("captcha", Messages.CAPTCHA_ERROR); + final String reCaptchaResponse = captchaService.verifyRecaptcha(remoteAddr, gReponse); + if (!reCaptchaResponse.isEmpty()) { + bindingResult.rejectValue("captcha", reCaptchaResponse); } } else { bindingResult.rejectValue("captcha", Messages.CAPTCHA_LOADING_ERROR); } } - return bindingResult; } } diff --git a/wise-webapp/src/main/resources/messages_ca.properties b/wise-webapp/src/main/resources/messages_ca.properties index 9b499c7e..04fbce13 100644 --- a/wise-webapp/src/main/resources/messages_ca.properties +++ b/wise-webapp/src/main/resources/messages_ca.properties @@ -52,7 +52,6 @@ PASSWORD_MISSMATCH=La contrasenya no concorda WISEMAPPING_ACCOUNT_MESSAGE=Si us plau verifiqui la informació i llegeixi les condicions del servei. REGISTRATION_CLICK_ADVICE= Seleccionant "Registre" està acceptant les condicions del servei. REGISTRATION_TITLE_MSG=Completi el següent formulari per a convertir-se en memore de la comunitat WiseMapping.
El registre és
de franc i només és un moment. -CAPTCHA_ERROR=Entri els caràcters com a la imatge superior. CREATOR=Creador CREATION_TIME=Data de creació EDITORS=Editors diff --git a/wise-webapp/src/main/resources/messages_de.properties b/wise-webapp/src/main/resources/messages_de.properties index a59d134a..62207eef 100644 --- a/wise-webapp/src/main/resources/messages_de.properties +++ b/wise-webapp/src/main/resources/messages_de.properties @@ -64,7 +64,6 @@ CHANGE_PASSWORD_SUCCESS=Ihr Passwort wurde erfolgreich geändert WISEMAPPING_ACCOUNT_MESSAGE=Bitte überprüfen Sie die eingegebenen WiseMapping Benutzerkonto Informationen und Geschäftsbedingungen REGISTRATION_CLICK_ADVICE= Mit der Registrierung erklären Sie ihr Einverständnis mit den Geschäftsbedingungen und Datenschutzregeln von WiseMapping. REGISTRATION_TITLE_MSG=Bitte fülle die Felder aus, um ein Mitglied der WiseMapping Gemeinschaft zu werden. Die Registrierung is kostenlos und in wenigen Augenblicken erledigt. -CAPTCHA_ERROR=Bitte geben Sie die Buchstaben wie auf dem Bild dargestellt ein. CREATOR=Urheber CREATION_TIME=Erstellungs Datum EDITORS=Verfasser diff --git a/wise-webapp/src/main/resources/messages_en.properties b/wise-webapp/src/main/resources/messages_en.properties index 3722a39c..afa07fc6 100644 --- a/wise-webapp/src/main/resources/messages_en.properties +++ b/wise-webapp/src/main/resources/messages_en.properties @@ -66,7 +66,6 @@ CHANGE_PASSWORD_SUCCESS=Your password has been changed successfully. WISEMAPPING_ACCOUNT_MESSAGE=Please check the WiseMapping Account information you've entered above, and review the Terms of Service REGISTRATION_CLICK_ADVICE= By clicking on 'Register' below you are agreeing to the Terms of Service above and the Privacy Policy. REGISTRATION_TITLE_MSG=Please, fill the fields and become a member of WiseMapping community. Registration is Free and takes just a moment. -CAPTCHA_ERROR=Enter the letters as they are shown in the image above. CREATOR=Creator CREATION_TIME=Creation Time EDITORS=Editors diff --git a/wise-webapp/src/main/resources/messages_es.properties b/wise-webapp/src/main/resources/messages_es.properties index ac2848e3..79b86c7f 100644 --- a/wise-webapp/src/main/resources/messages_es.properties +++ b/wise-webapp/src/main/resources/messages_es.properties @@ -52,7 +52,6 @@ PASSWORD_MISSMATCH=La contraseña no concuerda WISEMAPPING_ACCOUNT_MESSAGE=Por favor, verifique la información que ha ingresado y lea las condiciones del servicio. REGISTRATION_CLICK_ADVICE= Seleccionando 'Registración' esta aceptando las condiciones de uso de arriba y la politica de privacidad. REGISTRATION_TITLE_MSG=Complete el siguiente formulario para convertirse en un miembro de la comunidad de WiseMapping.
La registración es Gratis y sólo toma un momento. -CAPTCHA_ERROR=Ingrese los caracteres tal como son mostrados en la imagen arriba. CREATOR=Creador CREATION_TIME=Fecha de creación EDITORS=Editores diff --git a/wise-webapp/src/main/resources/messages_fr.properties b/wise-webapp/src/main/resources/messages_fr.properties index cab4963e..8f93bed4 100644 --- a/wise-webapp/src/main/resources/messages_fr.properties +++ b/wise-webapp/src/main/resources/messages_fr.properties @@ -69,7 +69,6 @@ CHANGE_PASSWORD_SUCCESS=Votre mot de passe a été changé avec succès. WISEMAPPING_ACCOUNT_MESSAGE=Merci de vérifier l'information de Compte WiseMapping que vous avez saisie, et de relire les conditions de service REGISTRATION_CLICK_ADVICE=En cliquant "M'enregistrer" ci-dessous, vous acceptez les conditions de service ci-dessus ainsi que les règles de confidentialité. REGISTRATION_TITLE_MSG=Devenez membre de la communauté WiseMapping en remplissant les champs ci-dessous. L'inscription est gratuite et ne prend qu'un instant. -CAPTCHA_ERROR=Saisissez les caractères affichés dans l'image ci-dessus. CREATOR=Créateur CREATION_TIME=Heure de création EDITORS=Editeurs diff --git a/wise-webapp/src/main/resources/messages_it.properties b/wise-webapp/src/main/resources/messages_it.properties index 44868599..3e33deea 100644 --- a/wise-webapp/src/main/resources/messages_it.properties +++ b/wise-webapp/src/main/resources/messages_it.properties @@ -64,7 +64,6 @@ CHANGE_PASSWORD_SUCCESS=La password è stata cambiata correttamente WISEMAPPING_ACCOUNT_MESSAGE=Prego, controllare le informazioni del tuo account WiseMapping appena inserite, e prendi note dei Termini di Servizio REGISTRATION_CLICK_ADVICE= Cliccando su 'Registra' di seguito, si accettano i Termini di Servizio riportati e le Privacy Policy di cui sopra. REGISTRATION_TITLE_MSG=Prego, compilare tutti i campi per diventare membri della Community WiseMapping. La registrazione è Free richiede pochi istanti. -CAPTCHA_ERROR=Inserire le lettere così come appaiono sull'immagine riportata qui sopra. CREATOR=Creatore CREATION_TIME=Orario di creazione EDITORS=Editori diff --git a/wise-webapp/src/main/resources/messages_pt_BR.properties b/wise-webapp/src/main/resources/messages_pt_BR.properties index b4d3b90d..7a3ad9a4 100644 --- a/wise-webapp/src/main/resources/messages_pt_BR.properties +++ b/wise-webapp/src/main/resources/messages_pt_BR.properties @@ -62,7 +62,6 @@ CHANGE_PASSWORD_SUCCESS=Sua senha foi alterada com sucesso. WISEMAPPING_ACCOUNT_MESSAGE=Confira a informação da conta WiseMapping que você inseriu acima e reveja os Termos de Serviço. REGISTRATION_CLICK_ADVICE= Clicando em Registrar abaixo você está concordando com os Termos de Seviço acima e a Política de Privacidade. REGISTRATION_TITLE_MSG=Preencha os campos e toene-se membro da comunidade WiseMapping. O Registro é Gratuito e leva só alguns instantes. -CAPTCHA_ERROR=Digite as letras como são exibidas na imagem acima. CREATOR=Criador CREATION_TIME=Tempo de Criação EDITORS=Editores diff --git a/wise-webapp/src/main/resources/messages_zh_CN.properties b/wise-webapp/src/main/resources/messages_zh_CN.properties index 688c392f..a02f6115 100644 --- a/wise-webapp/src/main/resources/messages_zh_CN.properties +++ b/wise-webapp/src/main/resources/messages_zh_CN.properties @@ -63,7 +63,6 @@ CHANGE_PASSWORD_SUCCESS=密码修改成功! WISEMAPPING_ACCOUNT_MESSAGE=请检查已输入的账户信息,并查阅服务条款 REGISTRATION_CLICK_ADVICE= 点击下面的“注册”,表示你同意上面提到的服务条款和隐私政策。 REGISTRATION_TITLE_MSG=请填写表单,你将成为WiseMapping社区的一员。注册 免费 快速。 -CAPTCHA_ERROR=输入你在上面的图像中看到的字符。 CREATOR=创建者 CREATION_TIME=创建时间 EDITORS=编辑者 diff --git a/wise-webapp/src/main/resources/messages_zh_TW.properties b/wise-webapp/src/main/resources/messages_zh_TW.properties index 7b4441aa..04e80663 100644 --- a/wise-webapp/src/main/resources/messages_zh_TW.properties +++ b/wise-webapp/src/main/resources/messages_zh_TW.properties @@ -64,7 +64,6 @@ CHANGE_PASSWORD_SUCCESS=密碼修改成功! WISEMAPPING_ACCOUNT_MESSAGE=請檢查已輸入的帳戶資訊,並查閱服務條款 REGISTRATION_CLICK_ADVICE= 點擊下麵的“註冊”,表示你同意上面提到的服務條款和隱私政策。 REGISTRATION_TITLE_MSG=請填寫表單,你將成為WiseMapping社區的一員。註冊 免費 快速。 -CAPTCHA_ERROR=輸入你在上面的圖像中看到的字元。 CREATOR=創建者 CREATION_TIME=創建時間 EDITORS=編輯者 diff --git a/wise-webapp/src/main/webapp/WEB-INF/app.properties b/wise-webapp/src/main/webapp/WEB-INF/app.properties index 54300703..162dbaa3 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/app.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/app.properties @@ -75,12 +75,12 @@ mail.errorReporterEmail= ################################################################################## # Enable captcha confirmation -google.recaptcha.enabled = true +google.recaptcha2.enabled = true # ReCaptcha is the default captcha. Public and private keys are required. # More Info: http://www.google.com/recaptcha . -google.recaptcha.privateKey = 6LeQ4tISAAAAAMfHMPRKyHupTfA-KE4QeTCnLXhK -google.recaptcha.publicKey = 6LeQ4tISAAAAALzCGKNgRv8UqsDx7Cb0vq4wbJBr +google.recaptcha2.siteKey = 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI +google.recaptcha2.secretKey = 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe ################################################################################## # Site configuration diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties b/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties index e44a9c52..f1555fcd 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties @@ -1,9 +1,10 @@ -log4j.rootLogger=DEBUG, stdout, R -log4j.logger.com.wisemapping=DEBUG,stdout,R -log4j.logger.org.springframework=DEBUG,stdout,R -log4j.logger.org.codehaus.jackson=DEBUG,stdout,R -log4j.logger.org.hibernate=DEBUG,stdout,R -log4j.logger.org.hibernate.engine.StatefulPersistenceContext=DEBUG,stdout,R +log4j.rootLogger=WARN, stdout, R +log4j.logger.com.wisemapping=WARN,stdout,R +log4j.logger.org.springframework=WARN,stdout,R +log4j.logger.org.codehaus.jackson=WARN,stdout,R +log4j.logger.org.hibernate=WARN,stdout,R +log4j.logger.org.hibernate.engine.StatefulPersistenceContext=ERROR,stdout,R + #log4j.logger.org.hibernate.SQL=WARN,stdout,R diff --git a/wise-webapp/src/main/webapp/WEB-INF/heroku.properties b/wise-webapp/src/main/webapp/WEB-INF/heroku.properties deleted file mode 100644 index 67176a87..00000000 --- a/wise-webapp/src/main/webapp/WEB-INF/heroku.properties +++ /dev/null @@ -1,62 +0,0 @@ -################################################################################## -# Database Configuration -################################################################################## - -# MySQL 5.X configuration properties -database.url=${DATABASE_URL} -database.driver=${DATABASE_DRIVER} -database.hibernate.dialect=${DATABASE_HIBERNATE_DIALECT} -database.username=${DATABASE_USERNAME} -database.password=${DATABASE_PASSWORD} - -#------------------------ -# Sendgrid Configuration -#------------------------ -mail.smtp.port=587 -mail.smtp.host=smtp.sendgrid.net -mail.username=${SENDGRID_USERNAME} -mail.password=${SENDGRID_PASSWORD} -mail.smtp.auth=true -mail.smtp.starttls.enable=true -mail.smtp.quitwait=false - -# Required: "from" email account that will appear in the emails sent from the sender. -mail.serverSendEmail=daemon@wisemapping.herokuapp.com - -# Optional: Support account that the users could use to contact you. This address will appear in emails and in some places in the site. -mail.supportEmail=support@wisemapping.com - -# Optional: Unexpected errors will be reported to this address. -mail.errorReporterEmail=bug-report@wisemapping.com - -################################################################################## -# 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 -google.recaptcha.enabled = true - -# ReCaptcha is the default captcha. Public and private keys are required. -# More Info: http://www.google.com/recaptcha . -google.recaptcha.privateKey = 6LeQ4tISAAAAAMfHMPRKyHupTfA-KE4QeTCnLXhK -google.recaptcha.publicKey = 6LeQ4tISAAAAALzCGKNgRv8UqsDx7Cb0vq4wbJBr - -################################################################################## -# Site configuration -################################################################################## - -# Site administration user. This user will have special permissions for operations such as removing users, set password -# etc. -admin.user = admin@wisemapping.org - -# Site URL. This url will be used during sharing emails and public views. -site.baseurl = http://http://wisemapping.herokuapp.com:8080 - -################################################################################## -# Google Analytics Settings -################################################################################## -google.analytics.enabled=false -google.analytics.account=UA-XXXX \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-db.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-db.xml index 7319eca1..2879b871 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-db.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-db.xml @@ -6,7 +6,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security - http://www.springframework.org/schema/security/spring-security-3.1.xsd"> + http://www.springframework.org/schema/security/spring-security-3.2.xsd"> diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml index 0307c5e7..1fa17edd 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security - http://www.springframework.org/schema/security/spring-security-3.1.xsd"> + http://www.springframework.org/schema/security/spring-security-3.2.xsd"> diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml index a821492d..105e772e 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml @@ -6,7 +6,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security - http://www.springframework.org/schema/security/spring-security-3.1.xsd"> + http://www.springframework.org/schema/security/spring-security-3.2.xsd"> diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml index 923939a0..09a59707 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml @@ -43,6 +43,10 @@ + + + + diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml index 2585c731..99a22d92 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml @@ -86,12 +86,6 @@ class="org.springframework.web.servlet.i18n.SessionLocaleResolver"> - - - - - - diff --git a/wise-webapp/src/main/webapp/jsp/template.jsp b/wise-webapp/src/main/webapp/jsp/template.jsp index 3a80c34d..652218a1 100644 --- a/wise-webapp/src/main/webapp/jsp/template.jsp +++ b/wise-webapp/src/main/webapp/jsp/template.jsp @@ -24,7 +24,6 @@ - <spring:message code="SITE.TITLE"/>- <c:choose> @@ -44,6 +43,8 @@ <script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.min.js"></script> <script src="js/less.js" type="text/javascript"></script> + <script src='https://www.google.com/recaptcha/api.js'></script> + </head> <body> diff --git a/wise-webapp/src/main/webapp/jsp/userRegistration.jsp b/wise-webapp/src/main/webapp/jsp/userRegistration.jsp index 8bb4fb6c..e0014b04 100644 --- a/wise-webapp/src/main/webapp/jsp/userRegistration.jsp +++ b/wise-webapp/src/main/webapp/jsp/userRegistration.jsp @@ -47,11 +47,9 @@ </div> <div class="form-group"> <div class="col-md-10 col-md-offset-2"> - <c:if test="${requestScope.captchaEnabled}"> - ${requestScope.captchaHtml} - <p> - <form:errors path="captcha" cssClass="errorMsg"/> - </p> + <c:if test="${requestScope.recaptchaEnabled}"> + <div class="g-recaptcha" data-sitekey="${requestScope.recaptchaSiteKey}"></div> + <p>${requestScope.captcha}</p> </c:if> </div> </div> diff --git a/wise-webapp/src/test/resources/data/svg/bug-nbsp.svg b/wise-webapp/src/test/resources/data/svg/bug-nbsp.svg index e74e5a98..13df10ec 100644 --- a/wise-webapp/src/test/resources/data/svg/bug-nbsp.svg +++ b/wise-webapp/src/test/resources/data/svg/bug-nbsp.svg @@ -1,4 +1,4 @@ -<svg xmlns="http://www.w3.org/2000/svg" focusable="true" id="workspace" preserveAspectRatio="none" width="1366" height="768" +<svg focusable="true" id="workspace" preserveAspectRatio="none" width="1366" height="768" viewBox="-1155.6372189600004 -720.729471672 2410.0770093120004 1355.0066933760004"> <path style="fill:none " stroke-width="1px" stroke="#495879" stroke-opacity="1" fill="#495879" fill-opacity="1" visibility="visible" d="M-158,567 C-168,567 -178,689 -188,689"></path> diff --git a/wise-webapp/src/test/resources/data/svg/bug1.svg b/wise-webapp/src/test/resources/data/svg/bug1.svg index 8c3f48ff..70a750aa 100644 --- a/wise-webapp/src/test/resources/data/svg/bug1.svg +++ b/wise-webapp/src/test/resources/data/svg/bug1.svg @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg xmlns="http://www.w3.org/2000/svg" focusable="true" id="workspace" preserveAspectRatio="none" width="1024" height="768" +<svg focusable="true" id="workspace" preserveAspectRatio="none" width="1024" height="768" viewBox="-427.77 -328.5450000000001 903.1680000000001 677.3760000000001"> <path style="fill:none " stroke-width="1px" stroke="#495879" stroke-opacity="1" fill="#495879" fill-opacity="1" d="M-384,78 C-393,78 -404,92 -413,92" visibility="visible"></path>