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:
@@ -24,6 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -309,7 +310,7 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
String sql = "SELECT * FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
PlayerAuth auth;
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
pst.setString(1, user.toLowerCase());
|
||||
pst.setString(1, user.toLowerCase(Locale.ROOT));
|
||||
try (ResultSet rs = pst.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
int id = rs.getInt(col.ID);
|
||||
@@ -377,11 +378,11 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
|
||||
@Override
|
||||
public boolean removeAuth(String user) {
|
||||
user = user.toLowerCase();
|
||||
user = user.toLowerCase(Locale.ROOT);
|
||||
String sql = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
sqlExtension.removeAuth(user, con);
|
||||
pst.setString(1, user.toLowerCase());
|
||||
pst.setString(1, user.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
@@ -402,7 +403,7 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
String sql = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
for (String name : toPurge) {
|
||||
pst.setString(1, name.toLowerCase());
|
||||
pst.setString(1, name.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
@@ -470,7 +471,7 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
String sql = "UPDATE " + tableName + " SET " + col.TOTP_KEY + " = ? WHERE " + col.NAME + " = ?";
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
pst.setString(1, totpKey);
|
||||
pst.setString(2, user.toLowerCase());
|
||||
pst.setString(2, user.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
|
||||
Reference in New Issue
Block a user