#567 Add/change email should be aware of account threshold
This commit is contained in:
@@ -250,9 +250,4 @@ public class CacheDataSource implements DataSource {
|
||||
public List<PlayerAuth> getLoggedPlayers() {
|
||||
return new ArrayList<>(PlayerCache.getInstance().getCache().values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmailStored(String email) {
|
||||
return source.isEmailStored(email);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,8 +185,6 @@ public interface DataSource {
|
||||
*/
|
||||
List<PlayerAuth> getLoggedPlayers();
|
||||
|
||||
boolean isEmailStored(String email);
|
||||
|
||||
/**
|
||||
* Reload the data source.
|
||||
*/
|
||||
|
||||
@@ -521,11 +521,6 @@ public class FlatFile implements DataSource {
|
||||
throw new UnsupportedOperationException("Flat file no longer supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmailStored(String email) {
|
||||
throw new UnsupportedOperationException("Flat file no longer supported");
|
||||
}
|
||||
|
||||
private static PlayerAuth buildAuthFromArray(String[] args) {
|
||||
// Format allows 2, 3, 4, 7, 8, 9 fields. Anything else is unknown
|
||||
if (args.length >= 2 && args.length <= 9 && args.length != 5 && args.length != 6) {
|
||||
|
||||
@@ -908,20 +908,6 @@ public class MySQL implements DataSource {
|
||||
return auths;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isEmailStored(String email) {
|
||||
String sql = "SELECT 1 FROM " + tableName + " WHERE UPPER(" + col.EMAIL + ") = UPPER(?)";
|
||||
try (Connection con = ds.getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
pst.setString(1, email);
|
||||
try (ResultSet rs = pst.executeQuery()) {
|
||||
return rs.next();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logSqlException(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private PlayerAuth buildAuthFromResultSet(ResultSet row) throws SQLException {
|
||||
String salt = col.SALT.isEmpty() ? null : row.getString(col.SALT);
|
||||
int group = col.GROUP.isEmpty() ? -1 : row.getInt(col.GROUP);
|
||||
|
||||
@@ -580,22 +580,6 @@ public class SQLite implements DataSource {
|
||||
return auths;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isEmailStored(String email) {
|
||||
String sql = "SELECT 1 FROM " + tableName + " WHERE " + col.EMAIL + " = ? COLLATE NOCASE;";
|
||||
ResultSet rs = null;
|
||||
try (PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
ps.setString(1, email);
|
||||
rs = ps.executeQuery();
|
||||
return rs.next();
|
||||
} catch (SQLException e) {
|
||||
logSqlException(e);
|
||||
} finally {
|
||||
close(rs);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private PlayerAuth buildAuthFromResultSet(ResultSet row) throws SQLException {
|
||||
String salt = !col.SALT.isEmpty() ? row.getString(col.SALT) : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user