Rename XF class into XFBCRYPT.
This commit is contained in:
@@ -7,7 +7,7 @@ import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.security.HashAlgorithm;
|
||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import fr.xephi.authme.security.crypts.XF;
|
||||
import fr.xephi.authme.security.crypts.XFBCRYPT;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.util.StringUtils;
|
||||
|
||||
@@ -300,14 +300,14 @@ public class MySQL implements DataSource {
|
||||
.build();
|
||||
rs.close();
|
||||
pst.close();
|
||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
||||
if (Settings.getPasswordHash == HashAlgorithm.XFBCRYPT) {
|
||||
pst = con.prepareStatement("SELECT data FROM xf_user_authenticate WHERE " + columnID + "=?;");
|
||||
pst.setInt(1, id);
|
||||
rs = pst.executeQuery();
|
||||
if (rs.next()) {
|
||||
Blob blob = rs.getBlob("data");
|
||||
byte[] bytes = blob.getBytes(1, (int) blob.length());
|
||||
pAuth.setPassword(new HashedPassword(XF.getHashFromBlob(bytes)));
|
||||
pAuth.setPassword(new HashedPassword(XFBCRYPT.getHashFromBlob(bytes)));
|
||||
}
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
@@ -490,7 +490,7 @@ public class MySQL implements DataSource {
|
||||
}
|
||||
rs.close();
|
||||
pst.close();
|
||||
} else if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
||||
} else if (Settings.getPasswordHash == HashAlgorithm.XFBCRYPT) {
|
||||
pst = con.prepareStatement("SELECT " + columnID + " FROM " + tableName + " WHERE " + columnName + "=?;");
|
||||
pst.setString(1, auth.getNickname());
|
||||
rs = pst.executeQuery();
|
||||
@@ -544,7 +544,7 @@ public class MySQL implements DataSource {
|
||||
}
|
||||
pst.executeUpdate();
|
||||
pst.close();
|
||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
||||
if (Settings.getPasswordHash == HashAlgorithm.XFBCRYPT) {
|
||||
String sql = "SELECT " + columnID + " FROM " + tableName + " WHERE " + columnName + "=?;";
|
||||
pst = con.prepareStatement(sql);
|
||||
pst.setString(1, user);
|
||||
@@ -641,7 +641,7 @@ public class MySQL implements DataSource {
|
||||
try (Connection con = getConnection()) {
|
||||
String sql;
|
||||
PreparedStatement pst;
|
||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
||||
if (Settings.getPasswordHash == HashAlgorithm.XFBCRYPT) {
|
||||
sql = "SELECT " + columnID + " FROM " + tableName + " WHERE " + columnName + "=?;";
|
||||
pst = con.prepareStatement(sql);
|
||||
pst.setString(1, user);
|
||||
@@ -942,14 +942,14 @@ public class MySQL implements DataSource {
|
||||
.groupId(group)
|
||||
.build();
|
||||
|
||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
||||
if (Settings.getPasswordHash == HashAlgorithm.XFBCRYPT) {
|
||||
int id = rs.getInt(columnID);
|
||||
pst.setInt(1, id);
|
||||
ResultSet rs2 = pst.executeQuery();
|
||||
if (rs2.next()) {
|
||||
Blob blob = rs2.getBlob("data");
|
||||
byte[] bytes = blob.getBytes(1, (int) blob.length());
|
||||
pAuth.setPassword(new HashedPassword(XF.getHashFromBlob(bytes)));
|
||||
pAuth.setPassword(new HashedPassword(XFBCRYPT.getHashFromBlob(bytes)));
|
||||
}
|
||||
rs2.close();
|
||||
}
|
||||
@@ -989,14 +989,14 @@ public class MySQL implements DataSource {
|
||||
.groupId(group)
|
||||
.build();
|
||||
|
||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
||||
if (Settings.getPasswordHash == HashAlgorithm.XFBCRYPT) {
|
||||
int id = rs.getInt(columnID);
|
||||
pst.setInt(1, id);
|
||||
ResultSet rs2 = pst.executeQuery();
|
||||
if (rs2.next()) {
|
||||
Blob blob = rs2.getBlob("data");
|
||||
byte[] bytes = blob.getBytes(1, (int) blob.length());
|
||||
pAuth.setPassword(new HashedPassword(XF.getHashFromBlob(bytes)));
|
||||
pAuth.setPassword(new HashedPassword(XFBCRYPT.getHashFromBlob(bytes)));
|
||||
}
|
||||
rs2.close();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public enum HashAlgorithm {
|
||||
WHIRLPOOL(fr.xephi.authme.security.crypts.WHIRLPOOL.class),
|
||||
WORDPRESS(fr.xephi.authme.security.crypts.WORDPRESS.class),
|
||||
XAUTH(fr.xephi.authme.security.crypts.XAUTH.class),
|
||||
XENFORO(fr.xephi.authme.security.crypts.XF.class),
|
||||
XFBCRYPT(fr.xephi.authme.security.crypts.XFBCRYPT.class),
|
||||
CUSTOM(null);
|
||||
|
||||
private final Class<? extends EncryptionMethod> clazz;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package fr.xephi.authme.security.crypts;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class XF extends BCRYPT {
|
||||
public class XFBCRYPT extends BCRYPT {
|
||||
private static final Pattern HASH_PATTERN = Pattern.compile("\"hash\";s.*\"(.*)?\"");
|
||||
|
||||
@Override
|
||||
@@ -515,11 +515,6 @@ public final class Settings {
|
||||
set("Xenoforo.predefinedSalt", null);
|
||||
changes = true;
|
||||
}
|
||||
if (configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA1") ||
|
||||
configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA256")) {
|
||||
set("settings.security.passwordHash", "XENFORO");
|
||||
changes = true;
|
||||
}
|
||||
if (!contains("Protection.enableProtection")) {
|
||||
set("Protection.enableProtection", false);
|
||||
changes = true;
|
||||
@@ -528,10 +523,6 @@ public final class Settings {
|
||||
set("settings.restrictions.removeSpeed", true);
|
||||
changes = true;
|
||||
}
|
||||
if (!contains("DataSource.mySQLMaxConections")) {
|
||||
set("DataSource.mySQLMaxConections", 25);
|
||||
changes = true;
|
||||
}
|
||||
if (!contains("Protection.countries")) {
|
||||
countries = new ArrayList<>();
|
||||
countries.add("US");
|
||||
@@ -741,6 +732,7 @@ public final class Settings {
|
||||
}
|
||||
|
||||
if (changes) {
|
||||
save();
|
||||
plugin.getLogger().warning("Merged new Config Options - I'm not an error, please don't report me");
|
||||
plugin.getLogger().warning("Please check your config.yml file for new configs!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user