diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-12-17 18:10:51 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-12-17 18:10:51 +0100 |
commit | 4db085417b5221c9fdd74f0c1ff704e1a827b193 (patch) | |
tree | 0d032eac1a3110b57b7ab0e760bd23d0c50eb1f9 /src | |
parent | a743872d30d72dfdc230cd72a1f529edd82e691e (diff) |
Work around authentication check blocking-call bug in Quarkus 1.10.x.
A bug causes authentication checks to fail when performed from inside
a reactive operation:
https://github.com/quarkusio/quarkus/issues/13835
To avoid such a reactive operation, we now render the HTML template
eagerly even in NewsletterResource#register, which is otherwise a
reactive implementation.
Change-Id: I26d6c1cc76eaa041a04c106b7cf06f024a0cded3
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java | 7 |
1 files changed, 4 insertions, 3 deletions
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 a46ee32..85af008 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java @@ -40,14 +40,14 @@ public class NewsletterResource { @POST @Path("register") @Transactional - public CompletionStage<TemplateInstance> register(@FormParam("email") String email) { + public CompletionStage<String> register(@FormParam("email") String email) { var existingSubscription = NewsletterSubscription.<NewsletterSubscription>find("email = ?1", email) .singleResultOptional(); if (existingSubscription.isPresent()) { // If a subscription already exists, act as if we had created it. This provides better // privacy to users than an error message does. - return CompletableFuture.completedStage(Templates.completeRegistration()); + return CompletableFuture.completedStage(Templates.completeRegistration().render()); } var subscription = new NewsletterSubscription(); @@ -56,7 +56,8 @@ public class NewsletterResource { var mailText = Templates.registrationMail(subscription.registrationKey); var sendJob = mailText.subject("MulkCMS newsletter registration").to(email).send(); - return sendJob.thenApply((x) -> Templates.completeRegistration()); + var page = Templates.completeRegistration().render(); + return sendJob.thenApply((x) -> page); } @GET |