diff options
Diffstat (limited to 'src/account-server/accounthandler.cpp')
-rw-r--r-- | src/account-server/accounthandler.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp index 0b81787b..506d80f8 100644 --- a/src/account-server/accounthandler.cpp +++ b/src/account-server/accounthandler.cpp @@ -169,6 +169,22 @@ static void handleLoginMessage(AccountClient &computer, MessageIn &msg) return; } + // get the IP address + int address = computer.getIP(); + + // TODO: Check IP against blacklist + + time_t lastAttempt = computer.getLastLoginAttempt(); + if ((time(NULL) - lastAttempt) < 1) + { + reply.writeByte(LOGIN_INVALID_TIME); + computer.send(reply); + return; + } + + // updates the time last attempted to login + computer.updateLoginAttempt(); + std::string username = msg.readString(); std::string password = msg.readString(); |