Prevent duplicate email addresses
This commit is contained in:
parent
8740d32621
commit
9f4089a752
@ -53,6 +53,14 @@ public final class POSTUsersIdRegister implements Handler<RoutingContext> {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockingCallback<User> sameEmailCallback = new BlockingCallback<>();
|
||||
User.findByEmail(email, sameEmailCallback);
|
||||
|
||||
if (sameEmailCallback.get() != null) {
|
||||
ErrorUtils.respondInvalidInput(ctx, email + " is already in use.");
|
||||
return;
|
||||
}
|
||||
|
||||
user.startRegistration(email);
|
||||
BlockingCallback<UpdateResult> callback = new BlockingCallback<>();
|
||||
user.save(callback);
|
||||
|
Loading…
Reference in New Issue
Block a user