mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 20:57:35 +01:00
Fix #1360
This commit is contained in:
parent
ea824ea3f0
commit
251eca9ccd
@ -574,7 +574,7 @@ public class MySQL implements DataSource {
|
|||||||
public boolean hasSession(String user) {
|
public boolean hasSession(String user) {
|
||||||
String sql = "SELECT " + col.HAS_SESSION + " FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
String sql = "SELECT " + col.HAS_SESSION + " FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||||
pst.setString(1, user);
|
pst.setString(1, user.toLowerCase());
|
||||||
try (ResultSet rs = pst.executeQuery()) {
|
try (ResultSet rs = pst.executeQuery()) {
|
||||||
return rs.next() && (rs.getInt(col.HAS_SESSION) == 1);
|
return rs.next() && (rs.getInt(col.HAS_SESSION) == 1);
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ public class SQLite implements DataSource {
|
|||||||
public boolean hasSession(String user) {
|
public boolean hasSession(String user) {
|
||||||
String sql = "SELECT " + col.HAS_SESSION + " FROM " + tableName + " WHERE LOWER(" + col.NAME + ")=?;";
|
String sql = "SELECT " + col.HAS_SESSION + " FROM " + tableName + " WHERE LOWER(" + col.NAME + ")=?;";
|
||||||
try (PreparedStatement pst = con.prepareStatement(sql)) {
|
try (PreparedStatement pst = con.prepareStatement(sql)) {
|
||||||
pst.setString(1, user);
|
pst.setString(1, user.toLowerCase());
|
||||||
try (ResultSet rs = pst.executeQuery()) {
|
try (ResultSet rs = pst.executeQuery()) {
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
return rs.getInt(col.HAS_SESSION) == 1;
|
return rs.getInt(col.HAS_SESSION) == 1;
|
||||||
@ -491,7 +491,7 @@ public class SQLite implements DataSource {
|
|||||||
String sql = "UPDATE " + tableName + " SET " + col.HAS_SESSION + "=? WHERE LOWER(" + col.NAME + ")=?;";
|
String sql = "UPDATE " + tableName + " SET " + col.HAS_SESSION + "=? WHERE LOWER(" + col.NAME + ")=?;";
|
||||||
try (PreparedStatement pst = con.prepareStatement(sql)) {
|
try (PreparedStatement pst = con.prepareStatement(sql)) {
|
||||||
pst.setInt(1, 1);
|
pst.setInt(1, 1);
|
||||||
pst.setString(2, user);
|
pst.setString(2, user.toLowerCase());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
logSqlException(ex);
|
logSqlException(ex);
|
||||||
@ -503,7 +503,7 @@ public class SQLite implements DataSource {
|
|||||||
String sql = "UPDATE " + tableName + " SET " + col.HAS_SESSION + "=? WHERE LOWER(" + col.NAME + ")=?;";
|
String sql = "UPDATE " + tableName + " SET " + col.HAS_SESSION + "=? WHERE LOWER(" + col.NAME + ")=?;";
|
||||||
try (PreparedStatement pst = con.prepareStatement(sql)) {
|
try (PreparedStatement pst = con.prepareStatement(sql)) {
|
||||||
pst.setInt(1, 0);
|
pst.setInt(1, 0);
|
||||||
pst.setString(2, user);
|
pst.setString(2, user.toLowerCase());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
logSqlException(ex);
|
logSqlException(ex);
|
||||||
|
Loading…
Reference in New Issue
Block a user