#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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user