[FIX] Postgresql no hwidId need

This commit is contained in:
Gravita 2021-12-10 20:57:21 +07:00
parent 796b2e2533
commit ce4f4cab62

View file

@ -27,7 +27,6 @@ public class PostgresSQLCoreProvider extends AuthCoreProvider {
public String accessTokenColumn; public String accessTokenColumn;
public String passwordColumn; public String passwordColumn;
public String serverIDColumn; public String serverIDColumn;
public String hardwareIdColumn;
public String table; public String table;
public PasswordVerifier passwordVerifier; public PasswordVerifier passwordVerifier;
@ -115,10 +114,9 @@ public void init(LaunchServer server) {
if (usernameColumn == null) logger.error("usernameColumn cannot be null"); if (usernameColumn == null) logger.error("usernameColumn cannot be null");
if (accessTokenColumn == null) logger.error("accessTokenColumn cannot be null"); if (accessTokenColumn == null) logger.error("accessTokenColumn cannot be null");
if (serverIDColumn == null) logger.error("serverIDColumn cannot be null"); if (serverIDColumn == null) logger.error("serverIDColumn cannot be null");
if (hardwareIdColumn == null) logger.error("hardwareIdColumn cannot be null");
if (table == null) logger.error("table cannot be null"); if (table == null) logger.error("table cannot be null");
// Prepare SQL queries // Prepare SQL queries
String userInfoCols = String.format("%s, %s, %s, %s, %s, %s", uuidColumn, usernameColumn, accessTokenColumn, serverIDColumn, passwordColumn, hardwareIdColumn); String userInfoCols = String.format("%s, %s, %s, %s, %s", uuidColumn, usernameColumn, accessTokenColumn, serverIDColumn, passwordColumn);
queryByUUIDSQL = customQueryByUUIDSQL != null ? customQueryByUUIDSQL : String.format("SELECT %s FROM %s WHERE %s=? LIMIT 1", userInfoCols, queryByUUIDSQL = customQueryByUUIDSQL != null ? customQueryByUUIDSQL : String.format("SELECT %s FROM %s WHERE %s=? LIMIT 1", userInfoCols,
table, uuidColumn); table, uuidColumn);
queryByUsernameSQL = customQueryByUsernameSQL != null ? customQueryByUsernameSQL : String.format("SELECT %s FROM %s WHERE %s=? LIMIT 1", queryByUsernameSQL = customQueryByUsernameSQL != null ? customQueryByUsernameSQL : String.format("SELECT %s FROM %s WHERE %s=? LIMIT 1",
@ -167,7 +165,7 @@ public void close() throws IOException {
private PostgresSQLUser constructUser(ResultSet set) throws SQLException { private PostgresSQLUser constructUser(ResultSet set) throws SQLException {
return set.next() ? new PostgresSQLUser(UUID.fromString(set.getString(uuidColumn)), set.getString(usernameColumn), return set.next() ? new PostgresSQLUser(UUID.fromString(set.getString(uuidColumn)), set.getString(usernameColumn),
set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), new ClientPermissions(), set.getLong(hardwareIdColumn)) : null; set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), new ClientPermissions()) : null;
} }
private User query(String sql, String value) throws IOException { private User query(String sql, String value) throws IOException {
@ -190,16 +188,14 @@ public static class PostgresSQLUser implements User {
protected String serverId; protected String serverId;
protected String password; protected String password;
protected ClientPermissions permissions; protected ClientPermissions permissions;
protected long hwidId;
public PostgresSQLUser(UUID uuid, String username, String accessToken, String serverId, String password, ClientPermissions permissions, long hwidId) { public PostgresSQLUser(UUID uuid, String username, String accessToken, String serverId, String password, ClientPermissions permissions) {
this.uuid = uuid; this.uuid = uuid;
this.username = username; this.username = username;
this.accessToken = accessToken; this.accessToken = accessToken;
this.serverId = serverId; this.serverId = serverId;
this.password = password; this.password = password;
this.permissions = permissions; this.permissions = permissions;
this.hwidId = hwidId;
} }
@Override @Override
@ -233,7 +229,6 @@ public String toString() {
"uuid=" + uuid + "uuid=" + uuid +
", username='" + username + '\'' + ", username='" + username + '\'' +
", permissions=" + permissions + ", permissions=" + permissions +
", hwidId=" + hwidId +
'}'; '}';
} }
} }