Remove captcha support

It uses reCAPTCHA v1, which hasn't worked since March 2018.

Signed-off-by: Peter Marheine <peter@taricorp.net>
master
Peter Marheine 6 years ago
parent b6a9b32b1c
commit 749342f25e
  1. 6
      airsonic-main/pom.xml
  2. 18
      airsonic-main/src/main/java/org/airsonic/player/controller/RecoverController.java
  3. 6
      airsonic-main/src/main/webapp/WEB-INF/jsp/recover.jsp
  4. BIN
      repo/net/tanesha/recaptcha4j/recaptcha4j/0.0.8/recaptcha4j-0.0.8-sources.jar
  5. BIN
      repo/net/tanesha/recaptcha4j/recaptcha4j/0.0.8/recaptcha4j-0.0.8.jar
  6. 6
      repo/net/tanesha/recaptcha4j/recaptcha4j/0.0.8/recaptcha4j-0.0.8.pom

@ -323,12 +323,6 @@
<version>1.1.0</version> <version>1.1.0</version>
</dependency> </dependency>
<dependency>
<groupId>net.tanesha.recaptcha4j</groupId>
<artifactId>recaptcha4j</artifactId>
<version>0.0.8</version>
</dependency>
<dependency> <dependency>
<groupId>de.u-mass</groupId> <groupId>de.u-mass</groupId>
<artifactId>lastfm-java</artifactId> <artifactId>lastfm-java</artifactId>

@ -1,8 +1,5 @@
package org.airsonic.player.controller; package org.airsonic.player.controller;
import net.tanesha.recaptcha.ReCaptcha;
import net.tanesha.recaptcha.ReCaptchaFactory;
import net.tanesha.recaptcha.ReCaptchaResponse;
import org.airsonic.player.domain.User; import org.airsonic.player.domain.User;
import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SecurityService;
import org.airsonic.player.service.SettingsService; import org.airsonic.player.service.SettingsService;
@ -49,21 +46,13 @@ public class RecoverController {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String usernameOrEmail = StringUtils.trimToNull(request.getParameter("usernameOrEmail")); String usernameOrEmail = StringUtils.trimToNull(request.getParameter("usernameOrEmail"));
ReCaptcha captcha = ReCaptchaFactory.newSecureReCaptcha("6LcZ3OMSAAAAANkKMdFdaNopWu9iS03V-nLOuoiH",
"6LcZ3OMSAAAAAPaFg89mEzs-Ft0fIu7wxfKtkwmQ", false);
boolean showCaptcha = true;
if (usernameOrEmail != null) { if (usernameOrEmail != null) {
map.put("usernameOrEmail", usernameOrEmail); map.put("usernameOrEmail", usernameOrEmail);
User user = getUserByUsernameOrEmail(usernameOrEmail); User user = getUserByUsernameOrEmail(usernameOrEmail);
String challenge = request.getParameter("recaptcha_challenge_field");
String uresponse = request.getParameter("recaptcha_response_field");
ReCaptchaResponse captchaResponse = captcha.checkAnswer(request.getRemoteAddr(), challenge, uresponse);
if (!captchaResponse.isValid()) { if (user == null) {
map.put("error", "recover.error.invalidcaptcha");
} else if (user == null) {
map.put("error", "recover.error.usernotfound"); map.put("error", "recover.error.usernotfound");
} else if (user.getEmail() == null) { } else if (user.getEmail() == null) {
map.put("error", "recover.error.noemail"); map.put("error", "recover.error.noemail");
@ -74,17 +63,12 @@ public class RecoverController {
user.setLdapAuthenticated(false); user.setLdapAuthenticated(false);
user.setPassword(password); user.setPassword(password);
securityService.updateUser(user); securityService.updateUser(user);
showCaptcha = false;
} else { } else {
map.put("error", "recover.error.sendfailed"); map.put("error", "recover.error.sendfailed");
} }
} }
} }
if (showCaptcha) {
map.put("captcha", captcha.createRecaptchaHtml(null, null));
}
return new ModelAndView("recover", "model", map); return new ModelAndView("recover", "model", map);
} }

@ -21,12 +21,6 @@
<input name="submit" type="submit" value="<fmt:message key="recover.send"/>"> <input name="submit" type="submit" value="<fmt:message key="recover.send"/>">
</c:if> </c:if>
<c:if test="${not empty model.captcha}">
<p style="padding-top: 1em">
<c:out value="${model.captcha}" escapeXml="false"/>
</p>
</c:if>
<c:if test="${not empty model.sentTo}"> <c:if test="${not empty model.sentTo}">
<p style="padding-top: 1em"><fmt:message key="recover.success"><fmt:param value="${model.sentTo}"/></fmt:message></p> <p style="padding-top: 1em"><fmt:message key="recover.success"><fmt:param value="${model.sentTo}"/></fmt:message></p>
</c:if> </c:if>

@ -1,6 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>net.tanesha.recaptcha4j</groupId>
<artifactId>recaptcha4j</artifactId>
<version>0.0.8</version>
</project>
Loading…
Cancel
Save