1
0
mirror of synced 2026-08-05 01:36:56 +00:00
Formatting as well as adding a missing defer

Issue gh-15699
This commit is contained in:
Josh Cummings
2024-10-07 16:40:22 -06:00
parent 2ca2e56383
commit b26f2af5d5
3 changed files with 12 additions and 7 deletions
@@ -58,8 +58,9 @@ public final class GenerateOneTimeTokenWebFilter implements WebFilter {
// @formatter:off
return this.matcher.matches(exchange)
.filter(ServerWebExchangeMatcher.MatchResult::isMatch)
.flatMap((mathResult) -> exchange.getFormData())
.flatMap((data) -> Mono.justOrEmpty(data.getFirst(USERNAME)))
.switchIfEmpty(chain.filter(exchange).then(Mono.empty()))
.then(exchange.getFormData())
.mapNotNull((data) -> data.getFirst(USERNAME))
.switchIfEmpty(chain.filter(exchange).then(Mono.empty()))
.flatMap((username) -> this.oneTimeTokenService.generate(new GenerateOneTimeTokenRequest(username)))
.flatMap((token) -> this.generatedOneTimeTokenHandler.handle(exchange, token));