diff --git a/src/main/java/net/frozenorb/apiv3/route/emailTokens/POSTEmailTokensIdConfirm.java b/src/main/java/net/frozenorb/apiv3/route/emailTokens/POSTEmailTokensIdConfirm.java index 08e82e1..6871bd7 100644 --- a/src/main/java/net/frozenorb/apiv3/route/emailTokens/POSTEmailTokensIdConfirm.java +++ b/src/main/java/net/frozenorb/apiv3/route/emailTokens/POSTEmailTokensIdConfirm.java @@ -33,6 +33,13 @@ public final class POSTEmailTokensIdConfirm implements Handler { return; } + User sameEmail = SyncUtils.runBlocking(v -> User.findByConfirmedEmail(user.getPendingEmail(), v)); + + if (sameEmail != null) { + ErrorUtils.respondInvalidInput(ctx, user.getPendingEmail() + " is already in use."); + return; + } + JsonObject requestBody = ctx.getBodyAsJson(); String password = requestBody.getString("password");