Modify User#findByPhone to search for usages in both confirmed numbers and pending numbers

This commit is contained in:
Colin McDonald 2016-07-10 14:20:16 -04:00
parent f84f8635a2
commit 07e1090445

View File

@ -84,7 +84,10 @@ public final class User {
} }
public static void findByPhone(String phoneNumber, SingleResultCallback<User> callback) { public static void findByPhone(String phoneNumber, SingleResultCallback<User> callback) {
usersCollection.find(new Document("phone", phoneNumber)).first(SyncUtils.vertxWrap(callback)); usersCollection.find(new Document("$or", ImmutableList.of(
new Document("phone", phoneNumber),
new Document("pendingPhone", phoneNumber)
))).first(SyncUtils.vertxWrap(callback));
} }
public static void findByEmail(String email, SingleResultCallback<User> callback) { public static void findByEmail(String email, SingleResultCallback<User> callback) {