Always specify Locale on toLowerCase and toUpperCase usages, fixes AuthMe not working correctly on machines with turkish locale. ('I'.toLowerCase() => 'ı')

This commit is contained in:
Gabriele C
2022-08-20 04:41:04 +02:00
parent c38e2aba28
commit 75b3a571e1
67 changed files with 217 additions and 143 deletions
@@ -21,6 +21,7 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
/**
@@ -217,7 +218,7 @@ public class AuthMeApi {
* @return true if player is registered, false otherwise
*/
public boolean isRegistered(String playerName) {
String player = playerName.toLowerCase();
String player = playerName.toLowerCase(Locale.ROOT);
return dataSource.isAuthAvailable(player);
}
@@ -241,7 +242,7 @@ public class AuthMeApi {
* @return true if the player was registered successfully
*/
public boolean registerPlayer(String playerName, String password) {
String name = playerName.toLowerCase();
String name = playerName.toLowerCase(Locale.ROOT);
if (isRegistered(name)) {
return false;
}