Fix critical bug in Bungee auth system
This commit is contained in:
parent
12aac00d41
commit
3df25410ef
1 changed files with 4 additions and 0 deletions
|
@ -51,6 +51,7 @@ public class AuthSystem {
|
||||||
private final Map<String, AuthData> database = new HashMap<>();
|
private final Map<String, AuthData> database = new HashMap<>();
|
||||||
|
|
||||||
public boolean register(String username, String password, String ip) {
|
public boolean register(String username, String password, String ip) {
|
||||||
|
username = username.toLowerCase();
|
||||||
synchronized (database) {
|
synchronized (database) {
|
||||||
AuthData authData = database.get(username);
|
AuthData authData = database.get(username);
|
||||||
if (authData != null)
|
if (authData != null)
|
||||||
|
@ -66,12 +67,14 @@ public class AuthSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegistered(String username) {
|
public boolean isRegistered(String username) {
|
||||||
|
username = username.toLowerCase();
|
||||||
synchronized (database) {
|
synchronized (database) {
|
||||||
return database.containsKey(username);
|
return database.containsKey(username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean changePass(String username, String password) {
|
public boolean changePass(String username, String password) {
|
||||||
|
username = username.toLowerCase();
|
||||||
synchronized (database) {
|
synchronized (database) {
|
||||||
AuthData authData = database.get(username);
|
AuthData authData = database.get(username);
|
||||||
authData.salt = createSalt(16);
|
authData.salt = createSalt(16);
|
||||||
|
@ -82,6 +85,7 @@ public class AuthSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean login(String username, String password) {
|
public boolean login(String username, String password) {
|
||||||
|
username = username.toLowerCase();
|
||||||
synchronized (database) {
|
synchronized (database) {
|
||||||
AuthData authData = database.get(username);
|
AuthData authData = database.get(username);
|
||||||
if (authData == null)
|
if (authData == null)
|
||||||
|
|
Loading…
Reference in a new issue