#477 Change lastlogin column from bigint to timestamp (work in progress)

- Alter column type
- Create migration for MySQL
- Unrelated: move DataSource enum to its own file
This commit is contained in:
ljacqu
2016-02-07 14:27:03 +01:00
parent 9cf7405f63
commit db4d4a7cce
13 changed files with 106 additions and 119 deletions
@@ -63,7 +63,7 @@ public class AsynchronousLogin {
this.settings = settings;
}
protected boolean needsCaptcha() {
private boolean needsCaptcha() {
if (Settings.useCaptcha) {
if (!plugin.captcha.containsKey(name)) {
plugin.captcha.putIfAbsent(name, 1);
@@ -87,7 +87,7 @@ public class AsynchronousLogin {
*
* @return PlayerAuth
*/
protected PlayerAuth preAuth() {
private PlayerAuth preAuth() {
if (PlayerCache.getInstance().isAuthenticated(name)) {
m.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
return null;
@@ -153,7 +153,6 @@ public class AsynchronousLogin {
.name(name)
.realName(realName)
.ip(ip)
.lastLogin(new Date().getTime())
.email(email)
.password(pAuth.getPassword())
.build();
@@ -221,14 +220,12 @@ public class AsynchronousLogin {
}
public void displayOtherAccounts(PlayerAuth auth) {
if (!Settings.displayOtherAccounts) {
return;
}
if (auth == null) {
if (!Settings.displayOtherAccounts || auth == null) {
return;
}
List<String> auths = this.database.getAllAuthsByName(auth);
if (auths.isEmpty() || auths.size() == 1) {
if (auths.size() < 2) {
return;
}
String message = "[AuthMe] " + StringUtils.join(", ", auths) + ".";
@@ -43,7 +43,7 @@ public class AsyncRegister {
this.settings = settings;
}
private boolean preRegisterCheck() throws Exception {
private boolean preRegisterCheck() {
String passLow = password.toLowerCase();
if (PlayerCache.getInstance().isAuthenticated(name)) {
m.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
@@ -86,18 +86,12 @@ public class AsyncRegister {
}
public void process() {
try {
if (!preRegisterCheck()) {
return;
}
if (preRegisterCheck()) {
if (email != null && !email.isEmpty()) {
emailRegister();
} else {
passwordRegister();
}
} catch (Exception e) {
ConsoleLogger.logException("Error during async register process", e);
m.send(player, MessageKey.ERROR);
}
}
@@ -130,7 +124,7 @@ public class AsyncRegister {
}
private void passwordRegister() throws Exception {
private void passwordRegister() {
final HashedPassword hashedPassword = plugin.getPasswordSecurity().computeHash(password, name);
PlayerAuth auth = PlayerAuth.builder()
.name(name)