diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 185898190..23781e2f7 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -334,17 +334,18 @@ public class MySQL implements DataSource { boolean useSalt = !columnSalt.isEmpty() || !StringUtils.isEmpty(auth.getPassword().getSalt()); sql = "INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," - + columnLastLogin + "," + columnRealName + + columnLastLogin + "," + columnRealName + "," + columnEmail + (useSalt ? "," + columnSalt : "") - + ") VALUES (?,?,?,?,?" + (useSalt ? ",?" : "") + ");"; + + ") VALUES (?,?,?,?,?,?" + (useSalt ? ",?" : "") + ");"; pst = con.prepareStatement(sql); pst.setString(1, auth.getNickname()); pst.setString(2, auth.getPassword().getHash()); pst.setString(3, auth.getIp()); pst.setLong(4, auth.getLastLogin()); pst.setString(5, auth.getRealName()); + pst.setString(6, auth.getEmail()); if (useSalt) { - pst.setString(6, auth.getPassword().getSalt()); + pst.setString(7, auth.getPassword().getSalt()); } pst.executeUpdate(); pst.close(); diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index 876bbfa18..9b14b1cc0 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -1,5 +1,11 @@ package fr.xephi.authme.datasource; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.cache.auth.PlayerAuth; +import fr.xephi.authme.security.crypts.HashedPassword; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.util.StringUtils; + import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; @@ -9,12 +15,6 @@ import java.sql.Statement; import java.util.ArrayList; import java.util.List; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.security.crypts.HashedPassword; -import fr.xephi.authme.settings.Settings; -import fr.xephi.authme.util.StringUtils; - /** */ public class SQLite implements DataSource { @@ -41,7 +41,7 @@ public class SQLite implements DataSource { * Constructor for SQLite. * * @throws ClassNotFoundException Exception - * @throws SQLException Exception + * @throws SQLException Exception */ public SQLite() throws ClassNotFoundException, SQLException { this.database = Settings.getMySQLDatabase; @@ -219,23 +219,26 @@ public class SQLite implements DataSource { + "is not set in the config!"); } pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + - "," + columnIp + "," + columnLastLogin + "," + columnRealName + ") VALUES (?,?,?,?,?);"); + "," + columnIp + "," + columnLastLogin + "," + columnRealName + "," + columnEmail + + ") VALUES (?,?,?,?,?,?);"); pst.setString(1, auth.getNickname()); pst.setString(2, password.getHash()); pst.setString(3, auth.getIp()); pst.setLong(4, auth.getLastLogin()); pst.setString(5, auth.getRealName()); + pst.setString(6, auth.getEmail()); pst.executeUpdate(); } else { pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," - + columnIp + "," + columnLastLogin + "," + columnSalt + "," + columnRealName - + ") VALUES (?,?,?,?,?,?);"); + + columnIp + "," + columnLastLogin + "," + columnRealName + "," + columnEmail + "," + columnSalt + + ") VALUES (?,?,?,?,?,?,?);"); pst.setString(1, auth.getNickname()); pst.setString(2, password.getHash()); pst.setString(3, auth.getIp()); pst.setLong(4, auth.getLastLogin()); - pst.setString(5, password.getSalt()); - pst.setString(6, auth.getRealName()); + pst.setString(5, auth.getRealName()); + pst.setString(6, auth.getEmail()); + pst.setString(7, password.getSalt()); pst.executeUpdate(); } } catch (SQLException ex) {