mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-02-09 08:21:30 +01:00
#369 Remove XENFORO enum entry
This commit is contained in:
parent
121d323221
commit
1c12278c4b
@ -303,16 +303,6 @@ public class MySQL implements DataSource {
|
|||||||
.build();
|
.build();
|
||||||
rs.close();
|
rs.close();
|
||||||
pst.close();
|
pst.close();
|
||||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
|
||||||
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.setHash(new String(bytes));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
ConsoleLogger.writeStackTrace(ex);
|
ConsoleLogger.writeStackTrace(ex);
|
||||||
@ -502,25 +492,6 @@ public class MySQL implements DataSource {
|
|||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
pst.close();
|
pst.close();
|
||||||
} else if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
|
||||||
pst = con.prepareStatement("SELECT " + columnID + " FROM " + tableName + " WHERE " + columnName + "=?;");
|
|
||||||
pst.setString(1, auth.getNickname());
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
if (rs.next()) {
|
|
||||||
int id = rs.getInt(columnID);
|
|
||||||
// Insert password in the correct table
|
|
||||||
pst2 = con.prepareStatement("INSERT INTO xf_user_authenticate (user_id, scheme_class, data) VALUES (?,?,?);");
|
|
||||||
pst2.setInt(1, id);
|
|
||||||
pst2.setString(2, "XenForo_Authentication_Core12");
|
|
||||||
byte[] bytes = auth.getHash().getBytes();
|
|
||||||
Blob blob = con.createBlob();
|
|
||||||
blob.setBytes(1, bytes);
|
|
||||||
pst2.setBlob(3, blob);
|
|
||||||
pst2.executeUpdate();
|
|
||||||
pst2.close();
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
pst.close();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
@ -548,34 +519,6 @@ public class MySQL implements DataSource {
|
|||||||
pst.setString(2, auth.getNickname());
|
pst.setString(2, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
pst.close();
|
pst.close();
|
||||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
|
||||||
sql = "SELECT " + columnID + " FROM " + tableName + " WHERE " + columnName + "=?;";
|
|
||||||
pst = con.prepareStatement(sql);
|
|
||||||
pst.setString(1, auth.getNickname());
|
|
||||||
ResultSet rs = pst.executeQuery();
|
|
||||||
if (rs.next()) {
|
|
||||||
int id = rs.getInt(columnID);
|
|
||||||
// Insert password in the correct table
|
|
||||||
sql = "UPDATE xf_user_authenticate SET data=? WHERE " + columnID + "=?;";
|
|
||||||
PreparedStatement pst2 = con.prepareStatement(sql);
|
|
||||||
byte[] bytes = auth.getHash().getBytes();
|
|
||||||
Blob blob = con.createBlob();
|
|
||||||
blob.setBytes(1, bytes);
|
|
||||||
pst2.setBlob(1, blob);
|
|
||||||
pst2.setInt(2, id);
|
|
||||||
pst2.executeUpdate();
|
|
||||||
pst2.close();
|
|
||||||
// ...
|
|
||||||
sql = "UPDATE xf_user_authenticate SET scheme_class=? WHERE " + columnID + "=?;";
|
|
||||||
pst2 = con.prepareStatement(sql);
|
|
||||||
pst2.setString(1, "XenForo_Authentication_Core12");
|
|
||||||
pst2.setInt(2, id);
|
|
||||||
pst2.executeUpdate();
|
|
||||||
pst2.close();
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
pst.close();
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
@ -679,24 +622,7 @@ public class MySQL implements DataSource {
|
|||||||
public synchronized boolean removeAuth(String user) {
|
public synchronized boolean removeAuth(String user) {
|
||||||
user = user.toLowerCase();
|
user = user.toLowerCase();
|
||||||
try (Connection con = getConnection()) {
|
try (Connection con = getConnection()) {
|
||||||
String sql;
|
PreparedStatement pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnName + "=?;");
|
||||||
PreparedStatement pst;
|
|
||||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
|
||||||
sql = "SELECT " + columnID + " FROM " + tableName + " WHERE " + columnName + "=?;";
|
|
||||||
pst = con.prepareStatement(sql);
|
|
||||||
pst.setString(1, user);
|
|
||||||
ResultSet rs = pst.executeQuery();
|
|
||||||
if (rs.next()) {
|
|
||||||
int id = rs.getInt(columnID);
|
|
||||||
sql = "DELETE FROM xf_user_authenticate WHERE " + columnID + "=" + id;
|
|
||||||
Statement st = con.createStatement();
|
|
||||||
st.executeUpdate(sql);
|
|
||||||
st.close();
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
pst.close();
|
|
||||||
}
|
|
||||||
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnName + "=?;");
|
|
||||||
pst.setString(1, user);
|
pst.setString(1, user);
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
return true;
|
return true;
|
||||||
@ -1136,17 +1062,6 @@ public class MySQL implements DataSource {
|
|||||||
.groupId(group)
|
.groupId(group)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
|
||||||
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.setHash(new String(bytes));
|
|
||||||
}
|
|
||||||
rs2.close();
|
|
||||||
}
|
|
||||||
auths.add(pAuth);
|
auths.add(pAuth);
|
||||||
}
|
}
|
||||||
pst.close();
|
pst.close();
|
||||||
@ -1191,17 +1106,6 @@ public class MySQL implements DataSource {
|
|||||||
.groupId(group)
|
.groupId(group)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
|
||||||
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.setHash(new String(bytes));
|
|
||||||
}
|
|
||||||
rs2.close();
|
|
||||||
}
|
|
||||||
auths.add(pAuth);
|
auths.add(pAuth);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -106,7 +106,6 @@ public class PasswordSecurity {
|
|||||||
case SHA1:
|
case SHA1:
|
||||||
case WHIRLPOOL:
|
case WHIRLPOOL:
|
||||||
case PLAINTEXT:
|
case PLAINTEXT:
|
||||||
case XENFORO:
|
|
||||||
case SHA512:
|
case SHA512:
|
||||||
case ROYALAUTH:
|
case ROYALAUTH:
|
||||||
case CRAZYCRYPT1:
|
case CRAZYCRYPT1:
|
||||||
|
Loading…
Reference in New Issue
Block a user