mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-20 06:08:26 +00:00
Heavy wip on login changes to get it to actually work like we want
This commit is contained in:
+30
-29
@@ -219,37 +219,38 @@ void Client::Handle_Login(const char* data, unsigned int size)
|
||||
|
||||
bool result = false;
|
||||
if (outbuffer[0] == 0 && outbuffer[1] == 0) {
|
||||
if (server.options.IsTokenLoginAllowed()) {
|
||||
cred = (&outbuffer[2 + user.length()]);
|
||||
result = server.db->GetLoginTokenDataFromToken(cred, connection->GetRemoteAddr(), db_account_id, user);
|
||||
}
|
||||
//if (server.options.IsTokenLoginAllowed()) {
|
||||
// cred = (&outbuffer[2 + user.length()]);
|
||||
// result = server.db->GetLoginTokenDataFromToken(cred, connection->GetRemoteAddr(), db_account_id, user);
|
||||
//}
|
||||
}
|
||||
else {
|
||||
if (server.options.IsPasswordLoginAllowed()) {
|
||||
cred = (&outbuffer[1 + user.length()]);
|
||||
if (server.db->GetLoginDataFromAccountName(user, db_account_password_hash, db_account_id) == false) {
|
||||
/* If we have auto_create_accounts enabled in the login.ini, we will process the creation of an account on our own*/
|
||||
if (
|
||||
server.options.CanAutoCreateAccounts() &&
|
||||
server.db->CreateLoginData(user, eqcrypt_hash(user, cred, mode), db_account_id) == true
|
||||
) {
|
||||
LogF(Logs::General, Logs::Error, "User {0} does not exist in the database, so we created it...", user);
|
||||
result = true;
|
||||
}
|
||||
else {
|
||||
LogF(Logs::General, Logs::Error, "Error logging in, user {0} does not exist in the database.", user);
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (eqcrypt_verify_hash(user, cred, db_account_password_hash, mode)) {
|
||||
result = true;
|
||||
}
|
||||
else {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (server.options.IsPasswordLoginAllowed()) {
|
||||
// result = false;
|
||||
// //cred = (&outbuffer[1 + user.length()]);
|
||||
// //if (server.db->GetLoginDataFromAccountName(user, db_account_password_hash, db_account_id) == false) {
|
||||
// // /* If we have auto_create_accounts enabled in the login.ini, we will process the creation of an account on our own*/
|
||||
// // if (
|
||||
// // server.options.CanAutoCreateAccounts() &&
|
||||
// // server.db->CreateLoginData(user, eqcrypt_hash(user, cred, mode), db_account_id) == true
|
||||
// // ) {
|
||||
// // LogF(Logs::General, Logs::Error, "User {0} does not exist in the database, so we created it...", user);
|
||||
// // result = true;
|
||||
// // }
|
||||
// // else {
|
||||
// // LogF(Logs::General, Logs::Error, "Error logging in, user {0} does not exist in the database.", user);
|
||||
// // result = false;
|
||||
// // }
|
||||
// //}
|
||||
// //else {
|
||||
// // if (eqcrypt_verify_hash(user, cred, db_account_password_hash, mode)) {
|
||||
// // result = true;
|
||||
// // }
|
||||
// // else {
|
||||
// // result = false;
|
||||
// // }
|
||||
// //}
|
||||
//}
|
||||
}
|
||||
|
||||
/* Login Accepted */
|
||||
|
||||
Reference in New Issue
Block a user