From 46749035a770a3542db8d1a6bb1258ea591e7078 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Thu, 17 Dec 2020 18:15:32 +0100 Subject: Act as if everything was fine if an invalid registration key is used. Change-Id: I78066954fef2e6afd9e49d56bd4c4060ad59796c --- .../eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/main/java/eu') diff --git a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java index 85af008..3786c9c 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java @@ -8,14 +8,12 @@ import io.quarkus.qute.api.CheckedTemplate; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; import javax.transaction.Transactional; -import javax.ws.rs.ClientErrorException; import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response.Status; @Path("/newsletter") @Produces(TEXT_HTML) @@ -66,11 +64,7 @@ public class NewsletterResource { public TemplateInstance finishRegistration(@QueryParam("key") String registrationKey) { NewsletterSubscription.find("registrationKey = ?1", registrationKey) .singleResultOptional() - .ifPresentOrElse( - s -> s.registrationKey = null, - () -> { - throw new ClientErrorException(Status.BAD_REQUEST); - }); + .ifPresent(s -> s.registrationKey = null); return Templates.registered(); } -- cgit v1.2.3