@ -20,7 +20,6 @@ import engine.objects.Account;
import engine.objects.PlayerCharacter ;
import engine.objects.PlayerCharacter ;
import engine.server.MBServerStatics ;
import engine.server.MBServerStatics ;
import engine.server.login.LoginServer ;
import engine.server.login.LoginServer ;
import engine.server.login.LoginServerMsgHandler ;
import engine.session.Session ;
import engine.session.Session ;
import org.pmw.tinylog.Logger ;
import org.pmw.tinylog.Logger ;
@ -49,17 +48,17 @@ public class ClientLoginInfoMsgHandler extends AbstractClientMsgHandler {
// Check to see if there is actually any data in uname.pass
// Check to see if there is actually any data in uname.pass
if ( uname . length ( ) = = 0 ) {
if ( uname . length ( ) = = 0 ) {
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "The username provided was zero length." , origin ) ;
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "The username provided was zero length." , origin ) ;
return true ;
return true ;
}
}
if ( pass . length ( ) = = 0 ) {
if ( pass . length ( ) = = 0 ) {
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "The password provided was zero length." , origin ) ;
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "The password provided was zero length." , origin ) ;
return true ;
return true ;
}
}
if ( LoginServer . loginServerRunning = = false ) {
if ( LoginServer . loginServerRunning = = false ) {
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_LOGINSERVER_BUSY , "" , origin ) ;
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_LOGINSERVER_BUSY , "" , origin ) ;
return true ;
return true ;
}
}
@ -73,7 +72,7 @@ public class ClientLoginInfoMsgHandler extends AbstractClientMsgHandler {
if ( account = = null ) {
if ( account = = null ) {
if ( ConfigManager . MB_LOGIN_AUTOREG . getValue ( ) . equalsIgnoreCase ( "false" ) ) {
if ( ConfigManager . MB_LOGIN_AUTOREG . getValue ( ) . equalsIgnoreCase ( "false" ) ) {
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_INVALID_USERNAME_PASSWORD , "Could not find account (" + uname + ')' , origin ) ;
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_INVALID_USERNAME_PASSWORD , "Could not find account (" + uname + ')' , origin ) ;
Logger . info ( "Could not find account (" + uname + ')' ) ;
Logger . info ( "Could not find account (" + uname + ')' ) ;
return true ;
return true ;
}
}
@ -83,7 +82,7 @@ public class ClientLoginInfoMsgHandler extends AbstractClientMsgHandler {
account = DbManager . AccountQueries . GET_ACCOUNT ( uname ) ;
account = DbManager . AccountQueries . GET_ACCOUNT ( uname ) ;
if ( account = = null ) {
if ( account = = null ) {
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_INVALID_USERNAME_PASSWORD , "Could not find account (" + uname + ')' , origin ) ;
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_INVALID_USERNAME_PASSWORD , "Could not find account (" + uname + ')' , origin ) ;
Logger . info ( "Could not auto-create (" + uname + ')' ) ;
Logger . info ( "Could not auto-create (" + uname + ')' ) ;
return true ;
return true ;
}
}
@ -96,7 +95,7 @@ public class ClientLoginInfoMsgHandler extends AbstractClientMsgHandler {
// Check number invalid login attempts. If 5 or greater, kick to login.
// Check number invalid login attempts. If 5 or greater, kick to login.
if ( account . getLoginAttempts ( ) > = MBServerStatics . MAX_LOGIN_ATTEMPTS ) {
if ( account . getLoginAttempts ( ) > = MBServerStatics . MAX_LOGIN_ATTEMPTS ) {
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "Too many login in attempts for '" + uname + '\'' , origin ) ;
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "Too many login in attempts for '" + uname + '\'' , origin ) ;
Logger . info ( "Too many login in attempts for '" + uname + '\'' ) ;
Logger . info ( "Too many login in attempts for '" + uname + '\'' ) ;
return true ;
return true ;
}
}
@ -110,19 +109,19 @@ public class ClientLoginInfoMsgHandler extends AbstractClientMsgHandler {
if ( ! account . passIsValid ( pass , origin . getClientIpAddress ( ) , origin . machineID ) ) {
if ( ! account . passIsValid ( pass , origin . getClientIpAddress ( ) , origin . machineID ) ) {
account . incrementLoginAttempts ( ) ;
account . incrementLoginAttempts ( ) ;
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_INVALID_USERNAME_PASSWORD , "" , origin ) ;
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_INVALID_USERNAME_PASSWORD , "" , origin ) ;
Logger . info ( "Incorrect password(" + uname + ')' ) ;
Logger . info ( "Incorrect password(" + uname + ')' ) ;
return true ;
return true ;
}
}
} catch ( IllegalArgumentException e1 ) {
} catch ( IllegalArgumentException e1 ) {
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "" , origin ) ;
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "" , origin ) ;
Logger . info ( "Failed forum account validation(" + uname + ')' ) ;
Logger . info ( "Failed forum account validation(" + uname + ')' ) ;
}
}
// Account deactivated
// Account deactivated
if ( account . status . equals ( Enum . AccountStatus . BANNED ) ) {
if ( account . status . equals ( Enum . AccountStatus . BANNED ) ) {
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_NO_MORE_PLAYTIME_ON_ACCOUNT , "" , origin ) ;
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_NO_MORE_PLAYTIME_ON_ACCOUNT , "" , origin ) ;
return true ;
return true ;
}
}
@ -132,7 +131,7 @@ public class ClientLoginInfoMsgHandler extends AbstractClientMsgHandler {
// If there is, then the account is in use and must be handled:
// If there is, then the account is in use and must be handled:
// kick the 'other connection'
// kick the 'other connection'
if ( session ! = null )
if ( session ! = null )
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "Your account has been accessed from a different IP & Port." , session . getConn ( ) ) ; // Logout the character
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "Your account has been accessed from a different IP & Port." , session . getConn ( ) ) ; // Logout the character
// TODO implement character logout
// TODO implement character logout
@ -153,10 +152,10 @@ public class ClientLoginInfoMsgHandler extends AbstractClientMsgHandler {
// send character select screen
// send character select screen
try {
try {
LoginServerMsgHandler . sendCharacterSelectScreen ( session ) ;
LoginServer . sendCharacterSelectScreen ( session ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
Logger . error ( "Unable to Send Character Select Screen to client" ) ;
Logger . error ( "Unable to Send Character Select Screen to client" ) ;
LoginServerMsgHandler . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "Unable to send Character Select Screen to client." , origin ) ;
LoginServer . KickToLogin ( MBServerStatics . LOGINERROR_UNABLE_TO_LOGIN , "Unable to send Character Select Screen to client." , origin ) ;
return true ;
return true ;
}
}