Chocorean / authmod

Allows you to safely accept demo versions on your server.
https://minecraft.curseforge.com/projects/authmod
Apache License 2.0
20 stars 10 forks source link

Only one player can register using DATABASE strategy without emails #35

Closed aleokdev closed 3 years ago

aleokdev commented 3 years ago

Describe the bug

When trying to register, a single message is sent, "Someone has already registered with this username or email", even though only one other user has registered (with a different username)

To Reproduce

Steps to reproduce the behavior:

  1. Connect to the server, which has email requirement OFF
  2. Register with one account
  3. Try to register with another completely different one

Expected behavior

It should let me register.

Versions

Authmod 3.0, Minecraft 1.12.2

Chocorean commented 3 years ago

Working correctly with FILE strategy at least as of b015d880

Chocorean commented 3 years ago

Bug has been reproduced with database strategy. @Mcdostone can you check for 1.15.2 if this is working properly?

Chocorean commented 3 years ago

Issue identified: Right now, using DATABASE strategy and without using emails, only one player can register because the email field is required and unique, but it is also equal to '' for everyone. As it also compares by emails, the first player to register already has '' as email address, which results in a PlayerAlreadyExistException

Chocorean commented 3 years ago

@Mcdostone I think this is still happening on your branch

Chocorean commented 3 years ago

@Mcdostone I just modified the readme (removed the unique constraint on email) and changed the query in src/main/java/io/chocorean/authmod/guard/datasource/db/playerDAO.java:public IPlayer find(IPlayer player) throws SQLException