Remove Case dependance, auto-update name on join into database (care
forums users!)
This commit is contained in:
@@ -26,7 +26,6 @@ public class AsyncronousLogin {
|
||||
protected Player player;
|
||||
protected String name;
|
||||
protected String password;
|
||||
protected String realName;
|
||||
protected boolean forceLogin;
|
||||
private AuthMe plugin;
|
||||
private DataSource database;
|
||||
@@ -37,8 +36,7 @@ public class AsyncronousLogin {
|
||||
AuthMe plugin, DataSource data) {
|
||||
this.player = player;
|
||||
this.password = password;
|
||||
name = player.getName().toLowerCase();
|
||||
realName = player.getName();
|
||||
name = player.getName();
|
||||
this.forceLogin = forceLogin;
|
||||
this.plugin = plugin;
|
||||
this.database = data;
|
||||
@@ -99,7 +97,7 @@ public class AsyncronousLogin {
|
||||
return null;
|
||||
}
|
||||
if (Settings.getMaxLoginPerIp > 0 && !plugin.authmePermissible(player, "authme.allow2accounts") && !getIP().equalsIgnoreCase("127.0.0.1") && !getIP().equalsIgnoreCase("localhost")) {
|
||||
if (plugin.isLoggedIp(realName, getIP())) {
|
||||
if (plugin.isLoggedIp(name, getIP())) {
|
||||
m._(player, "logged_in");
|
||||
return null;
|
||||
}
|
||||
@@ -126,14 +124,14 @@ public class AsyncronousLogin {
|
||||
boolean passwordVerified = true;
|
||||
if (!forceLogin)
|
||||
try {
|
||||
passwordVerified = PasswordSecurity.comparePasswordWithHash(password, hash, realName);
|
||||
passwordVerified = PasswordSecurity.comparePasswordWithHash(password, hash, name);
|
||||
} catch (Exception ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
m._(player, "error");
|
||||
return;
|
||||
}
|
||||
if (passwordVerified && player.isOnline()) {
|
||||
PlayerAuth auth = new PlayerAuth(name, hash, getIP(), new Date().getTime(), email, realName);
|
||||
PlayerAuth auth = new PlayerAuth(name, hash, getIP(), new Date().getTime(), email);
|
||||
database.updateSession(auth);
|
||||
|
||||
if (Settings.useCaptcha) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
this.database = data;
|
||||
this.pm = plugin.getServer().getPluginManager();
|
||||
this.player = player;
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.name = player.getName();
|
||||
this.limbo = LimboCache.getInstance().getLimboPlayer(name);
|
||||
this.auth = database.getAuth(name);
|
||||
this.playerCache = new FileCache(plugin);
|
||||
|
||||
@@ -19,7 +19,6 @@ public class AsyncronousRegister {
|
||||
protected Player player;
|
||||
protected String name;
|
||||
protected String password;
|
||||
protected String realName;
|
||||
protected String email = "";
|
||||
protected boolean allowRegister;
|
||||
private AuthMe plugin;
|
||||
@@ -30,8 +29,7 @@ public class AsyncronousRegister {
|
||||
AuthMe plugin, DataSource data) {
|
||||
this.player = player;
|
||||
this.password = password;
|
||||
name = player.getName().toLowerCase();
|
||||
realName = player.getName();
|
||||
name = player.getName();
|
||||
this.email = email;
|
||||
this.plugin = plugin;
|
||||
this.database = data;
|
||||
@@ -59,7 +57,7 @@ public class AsyncronousRegister {
|
||||
allowRegister = false;
|
||||
}
|
||||
|
||||
if (database.isAuthAvailable(player.getName().toLowerCase())) {
|
||||
if (database.isAuthAvailable(player.getName())) {
|
||||
m._(player, "user_regged");
|
||||
if (plugin.pllog.getStringList("players").contains(player.getName())) {
|
||||
plugin.pllog.getStringList("players").remove(player.getName());
|
||||
@@ -103,7 +101,7 @@ public class AsyncronousRegister {
|
||||
PlayerAuth auth = null;
|
||||
try {
|
||||
final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||
auth = new PlayerAuth(name, hashnew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email, realName);
|
||||
auth = new PlayerAuth(name, hashnew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
ConsoleLogger.showError(e.getMessage());
|
||||
m._(player, "error");
|
||||
@@ -142,9 +140,9 @@ public class AsyncronousRegister {
|
||||
return;
|
||||
}
|
||||
if (Settings.getMySQLColumnSalt.isEmpty() && !PasswordSecurity.userSalt.containsKey(name)) {
|
||||
auth = new PlayerAuth(name, hash, getIp(), new Date().getTime(), "your@email.com", player.getName());
|
||||
auth = new PlayerAuth(name, hash, getIp(), new Date().getTime(), "your@email.com");
|
||||
} else {
|
||||
auth = new PlayerAuth(name, hash, PasswordSecurity.userSalt.get(name), getIp(), new Date().getTime(), player.getName());
|
||||
auth = new PlayerAuth(name, hash, PasswordSecurity.userSalt.get(name), getIp(), new Date().getTime());
|
||||
}
|
||||
if (!database.saveAuth(auth)) {
|
||||
m._(player, "error");
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ProcessSyncronousEmailRegister implements Runnable {
|
||||
|
||||
public ProcessSyncronousEmailRegister(Player player, AuthMe plugin) {
|
||||
this.player = player;
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.name = player.getName();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
|
||||
public ProcessSyncronousPasswordRegister(Player player, AuthMe plugin) {
|
||||
this.player = player;
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.name = player.getName();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user