From b3d8ab2fbde80825f1386c722f8cc0f990bc2a91 Mon Sep 17 00:00:00 2001 From: Colin McDonald Date: Wed, 17 Aug 2016 20:44:39 -0400 Subject: [PATCH] Store all emails in lowercase --- src/main/java/net/frozenorb/apiv3/model/User.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/frozenorb/apiv3/model/User.java b/src/main/java/net/frozenorb/apiv3/model/User.java index dbfc713..d3a7a82 100644 --- a/src/main/java/net/frozenorb/apiv3/model/User.java +++ b/src/main/java/net/frozenorb/apiv3/model/User.java @@ -133,7 +133,7 @@ public final class User { } public static void findByConfirmedEmail(String email, SingleResultCallback callback) { - usersCollection.find(new Document("email", email)).first(SyncUtils.vertxWrap(callback)); + usersCollection.find(new Document("email", email.toLowerCase())).first(SyncUtils.vertxWrap(callback)); } public static void findByPasswordResetToken(String passwordResetToken, SingleResultCallback callback) { @@ -535,13 +535,13 @@ public final class User { } public void startEmailRegistration(String pendingEmail) { - this.pendingEmail = pendingEmail; + this.pendingEmail = pendingEmail.toLowerCase(); this.pendingEmailToken = UUID.randomUUID().toString().replace("-", ""); this.pendingEmailTokenSetAt = Instant.now(); } public void completeEmailRegistration(String email) { - this.email = email; + this.email = email.toLowerCase(); this.registeredAt = Instant.now(); this.pendingEmail = null; this.pendingEmailToken = null;