diff --git a/service/src/main/java/com/codeforcommunity/dataaccess/AuthDatabaseOperations.java b/service/src/main/java/com/codeforcommunity/dataaccess/AuthDatabaseOperations.java index cf00acbb..13bc581f 100644 --- a/service/src/main/java/com/codeforcommunity/dataaccess/AuthDatabaseOperations.java +++ b/service/src/main/java/com/codeforcommunity/dataaccess/AuthDatabaseOperations.java @@ -63,7 +63,7 @@ public AuthDatabaseOperations(DSLContext db) { public JWTData getUserJWTData(String email) { Optional maybeUser = Optional.ofNullable( - db.selectFrom(USERS).where(USERS.EMAIL.eq(email)).fetchOneInto(Users.class)); + db.selectFrom(USERS).where(USERS.EMAIL.equalIgnoreCase(email)).fetchOneInto(Users.class)); if (maybeUser.isPresent()) { Users user = maybeUser.get(); @@ -117,7 +117,7 @@ public Users getUserPojo(int userId) { public boolean isValidLogin(String email, String pass) { Optional maybeUser = Optional.ofNullable( - db.selectFrom(USERS).where(USERS.EMAIL.eq(email)).fetchOneInto(Users.class)); + db.selectFrom(USERS).where(USERS.EMAIL.equalIgnoreCase(email)).fetchOneInto(Users.class)); return maybeUser .filter(user -> Passwords.isExpectedPassword(pass, user.getPassHash())) @@ -132,7 +132,7 @@ public boolean isValidLogin(String email, String pass) { */ public UsersRecord createNewUser(NewUserRequest request) { String email = request.getEmail(); - boolean emailUsed = db.fetchExists(db.selectFrom(USERS).where(USERS.EMAIL.eq(email))); + boolean emailUsed = db.fetchExists(db.selectFrom(USERS).where(USERS.EMAIL.equalIgnoreCase(email))); if (emailUsed) { throw new EmailAlreadyInUseException(email); } diff --git a/service/src/main/java/com/codeforcommunity/processor/ProtectedUserProcessorImpl.java b/service/src/main/java/com/codeforcommunity/processor/ProtectedUserProcessorImpl.java index 414023b3..d3bee306 100644 --- a/service/src/main/java/com/codeforcommunity/processor/ProtectedUserProcessorImpl.java +++ b/service/src/main/java/com/codeforcommunity/processor/ProtectedUserProcessorImpl.java @@ -173,7 +173,7 @@ public void changeEmail(JWTData userData, ChangeEmailRequest changeEmailRequest) } if (Passwords.isExpectedPassword(changeEmailRequest.getPassword(), user.getPassHash())) { - if (db.fetchExists(USERS, USERS.EMAIL.eq(changeEmailRequest.getNewEmail()))) { + if (db.fetchExists(USERS, USERS.EMAIL.equalIgnoreCase(changeEmailRequest.getNewEmail()))) { throw new EmailAlreadyInUseException(changeEmailRequest.getNewEmail()); }