Skip to content

Commit

Permalink
Merge pull request #144 from Code-4-Community/kjung/fix
Browse files Browse the repository at this point in the history
Save emails as lowercase on signup
  • Loading branch information
chromium-52 authored Apr 10, 2024
2 parents 2111030 + 84ffc70 commit 9cb8e38
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ public boolean isValidLogin(String email, String pass) {
* table.
*/
public UsersRecord createNewUser(NewUserRequest request) {
String email = request.getEmail();
boolean emailUsed = db.fetchExists(db.selectFrom(USERS).where(USERS.EMAIL.equalIgnoreCase(email)));
String email = request.getEmail().toLowerCase();
boolean emailUsed =
db.fetchExists(db.selectFrom(USERS).where(USERS.EMAIL.equalIgnoreCase(email)));
if (emailUsed) {
throw new EmailAlreadyInUseException(email);
}
Expand All @@ -143,7 +144,7 @@ public UsersRecord createNewUser(NewUserRequest request) {

UsersRecord newUser = db.newRecord(USERS);
addAddressDataToUserRecord(newUser, request.getLocation());
newUser.setEmail(request.getEmail());
newUser.setEmail(email);
newUser.setPassHash(Passwords.createHash(request.getPassword()));
newUser.setPrivilegeLevel(PrivilegeLevel.STANDARD);
newUser.setPhotoRelease(request.getPhotoRelease());
Expand Down

0 comments on commit 9cb8e38

Please sign in to comment.