mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 20:57:35 +01:00
Fix saveAuth method didn't save email.
This commit is contained in:
parent
5187ce152a
commit
7eeabd68e7
@ -334,17 +334,18 @@ public class MySQL implements DataSource {
|
|||||||
boolean useSalt = !columnSalt.isEmpty() || !StringUtils.isEmpty(auth.getPassword().getSalt());
|
boolean useSalt = !columnSalt.isEmpty() || !StringUtils.isEmpty(auth.getPassword().getSalt());
|
||||||
sql = "INSERT INTO " + tableName + "("
|
sql = "INSERT INTO " + tableName + "("
|
||||||
+ columnName + "," + columnPassword + "," + columnIp + ","
|
+ columnName + "," + columnPassword + "," + columnIp + ","
|
||||||
+ columnLastLogin + "," + columnRealName
|
+ columnLastLogin + "," + columnRealName + "," + columnEmail
|
||||||
+ (useSalt ? "," + columnSalt : "")
|
+ (useSalt ? "," + columnSalt : "")
|
||||||
+ ") VALUES (?,?,?,?,?" + (useSalt ? ",?" : "") + ");";
|
+ ") VALUES (?,?,?,?,?,?" + (useSalt ? ",?" : "") + ");";
|
||||||
pst = con.prepareStatement(sql);
|
pst = con.prepareStatement(sql);
|
||||||
pst.setString(1, auth.getNickname());
|
pst.setString(1, auth.getNickname());
|
||||||
pst.setString(2, auth.getPassword().getHash());
|
pst.setString(2, auth.getPassword().getHash());
|
||||||
pst.setString(3, auth.getIp());
|
pst.setString(3, auth.getIp());
|
||||||
pst.setLong(4, auth.getLastLogin());
|
pst.setLong(4, auth.getLastLogin());
|
||||||
pst.setString(5, auth.getRealName());
|
pst.setString(5, auth.getRealName());
|
||||||
|
pst.setString(6, auth.getEmail());
|
||||||
if (useSalt) {
|
if (useSalt) {
|
||||||
pst.setString(6, auth.getPassword().getSalt());
|
pst.setString(7, auth.getPassword().getSalt());
|
||||||
}
|
}
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
pst.close();
|
pst.close();
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
package fr.xephi.authme.datasource;
|
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.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -9,12 +15,6 @@ import java.sql.Statement;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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 {
|
public class SQLite implements DataSource {
|
||||||
@ -41,7 +41,7 @@ public class SQLite implements DataSource {
|
|||||||
* Constructor for SQLite.
|
* Constructor for SQLite.
|
||||||
*
|
*
|
||||||
* @throws ClassNotFoundException Exception
|
* @throws ClassNotFoundException Exception
|
||||||
* @throws SQLException Exception
|
* @throws SQLException Exception
|
||||||
*/
|
*/
|
||||||
public SQLite() throws ClassNotFoundException, SQLException {
|
public SQLite() throws ClassNotFoundException, SQLException {
|
||||||
this.database = Settings.getMySQLDatabase;
|
this.database = Settings.getMySQLDatabase;
|
||||||
@ -219,23 +219,26 @@ public class SQLite implements DataSource {
|
|||||||
+ "is not set in the config!");
|
+ "is not set in the config!");
|
||||||
}
|
}
|
||||||
pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword +
|
pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword +
|
||||||
"," + columnIp + "," + columnLastLogin + "," + columnRealName + ") VALUES (?,?,?,?,?);");
|
"," + columnIp + "," + columnLastLogin + "," + columnRealName + "," + columnEmail +
|
||||||
|
") VALUES (?,?,?,?,?,?);");
|
||||||
pst.setString(1, auth.getNickname());
|
pst.setString(1, auth.getNickname());
|
||||||
pst.setString(2, password.getHash());
|
pst.setString(2, password.getHash());
|
||||||
pst.setString(3, auth.getIp());
|
pst.setString(3, auth.getIp());
|
||||||
pst.setLong(4, auth.getLastLogin());
|
pst.setLong(4, auth.getLastLogin());
|
||||||
pst.setString(5, auth.getRealName());
|
pst.setString(5, auth.getRealName());
|
||||||
|
pst.setString(6, auth.getEmail());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
} else {
|
} else {
|
||||||
pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + ","
|
pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + ","
|
||||||
+ columnIp + "," + columnLastLogin + "," + columnSalt + "," + columnRealName
|
+ columnIp + "," + columnLastLogin + "," + columnRealName + "," + columnEmail + "," + columnSalt
|
||||||
+ ") VALUES (?,?,?,?,?,?);");
|
+ ") VALUES (?,?,?,?,?,?,?);");
|
||||||
pst.setString(1, auth.getNickname());
|
pst.setString(1, auth.getNickname());
|
||||||
pst.setString(2, password.getHash());
|
pst.setString(2, password.getHash());
|
||||||
pst.setString(3, auth.getIp());
|
pst.setString(3, auth.getIp());
|
||||||
pst.setLong(4, auth.getLastLogin());
|
pst.setLong(4, auth.getLastLogin());
|
||||||
pst.setString(5, password.getSalt());
|
pst.setString(5, auth.getRealName());
|
||||||
pst.setString(6, auth.getRealName());
|
pst.setString(6, auth.getEmail());
|
||||||
|
pst.setString(7, password.getSalt());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user