forked from MagicBane/Server
Autoregister plugged in.
This commit is contained in:
@@ -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) {
|
||||||
|
|
||||||
|
if (ConfigManager.MB_LOGIN_AUTOREG.getValue().equals("FALSE")) {
|
||||||
this.KickToLogin(MBServerStatics.LOGINERROR_INVALID_USERNAME_PASSWORD, "Could not find account (" + uname + ')', clientConnection);
|
this.KickToLogin(MBServerStatics.LOGINERROR_INVALID_USERNAME_PASSWORD, "Could not find account (" + uname + ')', clientConnection);
|
||||||
Logger.info("Could not find account (" + uname + ')');
|
Logger.info("Could not find account (" + uname + ')');
|
||||||
return;
|
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())
|
||||||
|
|||||||
Reference in New Issue
Block a user