#792 Add columns for registration IP and registration date

- Add columns for reg date and IP
- Rename "ip" to "last IP"
This commit is contained in:
ljacqu
2017-10-14 17:37:34 +02:00
parent 1487fc0d9e
commit 52d6476058
37 changed files with 362 additions and 235 deletions
@@ -188,7 +188,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
long timeSinceLastLogin = System.currentTimeMillis() - auth.getLastLogin();
if(timeSinceLastLogin < 0
|| timeSinceLastLogin > (service.getProperty(PluginSettings.SESSIONS_TIMEOUT) * 60 * 1000)
|| !auth.getIp().equals(PlayerUtils.getPlayerIp(player))) {
|| !auth.getLastIp().equals(PlayerUtils.getPlayerIp(player))) {
service.send(player, MessageKey.SESSION_EXPIRED);
} else {
RestoreSessionEvent event = bukkitService.createAndCallEvent(
@@ -215,7 +215,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
final String ip = PlayerUtils.getPlayerIp(player);
auth.setRealName(player.getName());
auth.setLastLogin(System.currentTimeMillis());
auth.setIp(ip);
auth.setLastIp(ip);
dataSource.updateSession(auth);
// Successful login, so reset the captcha & temp ban count
@@ -227,8 +227,8 @@ public class AsynchronousLogin implements AsynchronousProcess {
service.send(player, MessageKey.LOGIN_SUCCESS);
// Other auths
List<String> auths = dataSource.getAllAuthsByIp(auth.getIp());
runCommandOtherAccounts(auths, player, auth.getIp());
List<String> auths = dataSource.getAllAuthsByIp(auth.getLastIp());
runCommandOtherAccounts(auths, player, auth.getLastIp());
displayOtherAccounts(auths, player);
final String email = auth.getEmail();
@@ -72,7 +72,7 @@ public class AsynchronousQuit implements AsynchronousProcess {
PlayerAuth auth = PlayerAuth.builder()
.name(name)
.realName(player.getName())
.ip(ip)
.lastIp(ip)
.lastLogin(System.currentTimeMillis())
.build();
database.updateSession(auth);
@@ -27,8 +27,8 @@ final class PlayerAuthBuilderHelper {
.realName(player.getName())
.password(hashedPassword)
.email(email)
.ip(PlayerUtils.getPlayerIp(player))
.location(player.getLocation())
.registrationIp(PlayerUtils.getPlayerIp(player))
.registrationDate(System.currentTimeMillis())
.build();
}
}