Browse Source

Autoregister plugged in.

pull/1/head
MagicBot 3 years ago
parent
commit
459d61b20a
  1. 20
      src/engine/server/login/LoginServerMsgHandler.java

20
src/engine/server/login/LoginServerMsgHandler.java

@ -12,6 +12,7 @@ package engine.server.login;
import engine.Enum; import engine.Enum;
import engine.Enum.DispatchChannel; import engine.Enum.DispatchChannel;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.gameManager.SessionManager; import engine.gameManager.SessionManager;
import engine.job.JobScheduler; import engine.job.JobScheduler;
@ -174,12 +175,25 @@ public class LoginServerMsgHandler implements NetMsgHandler {
account = DbManager.AccountQueries.GET_ACCOUNT(uname); account = DbManager.AccountQueries.GET_ACCOUNT(uname);
// Create the account if it doesn't exist and MB_LOGIN_AUTOREG is TRUE;
// This is to support MagicBox users without a web hosting skillset.
if (account == null) { if (account == null) {
this.KickToLogin(MBServerStatics.LOGINERROR_INVALID_USERNAME_PASSWORD, "Could not find account (" + uname + ')', clientConnection); if (ConfigManager.MB_LOGIN_AUTOREG.getValue().equals("FALSE")) {
Logger.info("Could not find account (" + uname + ')'); this.KickToLogin(MBServerStatics.LOGINERROR_INVALID_USERNAME_PASSWORD, "Could not find account (" + uname + ')', clientConnection);
return; Logger.info("Could not find account (" + uname + ')');
return;
}
DbManager.AccountQueries.CREATE_SINGLE(uname, pass);
account = DbManager.AccountQueries.GET_ACCOUNT(uname);
if (account == null) {
this.KickToLogin(MBServerStatics.LOGINERROR_INVALID_USERNAME_PASSWORD, "Could not find account (" + uname + ')', clientConnection);
Logger.info("Could not auto-create (" + uname + ')');
return;
}
} }
if (account.getLastLoginFailure() + MBServerStatics.RESET_LOGIN_ATTEMPTS_AFTER < System.currentTimeMillis()) if (account.getLastLoginFailure() + MBServerStatics.RESET_LOGIN_ATTEMPTS_AFTER < System.currentTimeMillis())

Loading…
Cancel
Save