Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tblLoginServerAccounts #38

Open
xackery opened this issue May 14, 2024 · 2 comments
Open

Fix tblLoginServerAccounts #38

xackery opened this issue May 14, 2024 · 2 comments

Comments

@xackery
Copy link
Contributor

xackery commented May 14, 2024

[Login] [Info] platform : PC , username : xackery is created
[Login] [MySQL Error] [1364] [Field 'creationIP' doesn't have a default value]
[INSERT INTO tblLoginServerAccounts (AccountName, AccountPassword, AccountEmail, LastLoginDate, LastIPAddress)  VALUES('xackery', SHA('nothing'), 'local_creation', NOW(), '127.0.0.1'); ]
[Login] [Error] Account did not existed in the database for xackery 
[Login] [Info] Client disconnected from the server, removing client.

seems
image

then

 Error] [1364] [Field 'ForumName' doesn't have a default value]
[INSERT INTO tblLoginServerAccounts (AccountName, AccountPassword, AccountEmail, LastLoginDate, LastIPAddress, creationIP)  VALUES('xackery', SHA('nothing'), 'local_creation', NOW(), '127.0.0.1', '127.0.0.1'); ]
@xackery
Copy link
Contributor Author

xackery commented May 14, 2024

Here's a fix diff:

diff --git a/loginserver/database.cpp b/loginserver/database.cpp
index 021c4e1..2e5ffd8 100644
--- a/loginserver/database.cpp
+++ b/loginserver/database.cpp
@@ -136,8 +136,8 @@ bool Database::CreateLoginData(const std::string &name, const std::string &passw
 
 	id = atoi(row[0]);
 
-	auto insert_query = fmt::format("INSERT INTO {0} (AccountName, AccountPassword, AccountEmail, LastLoginDate, LastIPAddress) "
-		" VALUES('{1}', SHA('{2}'), 'local_creation', NOW(), '127.0.0.1'); ",
+	auto insert_query = fmt::format("INSERT INTO {0} (AccountName, AccountPassword, AccountEmail, LastLoginDate, LastIPAddress, creationIP, forumname) "
+		" VALUES('{1}', SHA('{2}'), 'local_creation', NOW(), '127.0.0.1', '127.0.0.1', ''); ",
 		server.options.GetAccountTable(),
 		Strings::Escape(name),
 		Strings::Escape(password)
@@ -354,7 +354,7 @@ std::string Database::LoginSettings(std::string type)
 	return value.c_str();
 }
 
-bool Database::CheckSettings(int type) 
+bool Database::CheckSettings(int type)
 {
 	if (type == 1)
 	{

@jcon321
Copy link
Contributor

jcon321 commented Jun 4, 2024

Just a note about this issue... I'd ensure TAKP prod login.ini auto_create_accounts is FALSE before implementing above diff (99% sure it is). But just in case this bug was indirectly preventing auto creation.

I 2nd this diff - atm I have to include a sql file for devcontainer spin up. When this issue is closed I'll remove the manual injected sql file fix in devcontainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants