Fix issue where multiple users could confirm with the same email

This commit is contained in:
Colin McDonald 2016-07-23 14:29:26 -04:00
parent 95440504d5
commit 60dfe6b03e

View File

@ -33,6 +33,13 @@ public final class POSTEmailTokensIdConfirm implements Handler<RoutingContext> {
return; 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(); JsonObject requestBody = ctx.getBodyAsJson();
String password = requestBody.getString("password"); String password = requestBody.getString("password");