mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-23 14:47:44 +00:00
Fix account not found issue when logging in
This commit is contained in:
parent
9f2cf00b95
commit
dee3afcaf8
@ -226,18 +226,22 @@ public final class DispatchServer {
|
||||
Account account = DatabaseHelper.getAccountByName(requestData.account);
|
||||
|
||||
// Check if account exists, else create a new one.
|
||||
if (account == null && Grasscutter.getConfig().ServerOptions.AutomaticallyCreateAccounts) {
|
||||
// This account has been created AUTOMATICALLY. There will be no permissions added.
|
||||
account = DatabaseHelper.createAccountWithId(requestData.account, 0);
|
||||
|
||||
responseData.message = "OK";
|
||||
responseData.data.account.uid = account.getId();
|
||||
responseData.data.account.token = account.generateSessionKey();
|
||||
responseData.data.account.email = account.getEmail();
|
||||
} else if (!Grasscutter.getConfig().ServerOptions.AutomaticallyCreateAccounts) {
|
||||
responseData.retcode = -201;
|
||||
responseData.message = "Username not found.";
|
||||
if (account == null) {
|
||||
// Account doesnt exist, so we can either auto create it if the config value is set
|
||||
if (Grasscutter.getConfig().ServerOptions.AutomaticallyCreateAccounts) {
|
||||
// This account has been created AUTOMATICALLY. There will be no permissions added.
|
||||
account = DatabaseHelper.createAccountWithId(requestData.account, 0);
|
||||
|
||||
responseData.message = "OK";
|
||||
responseData.data.account.uid = account.getId();
|
||||
responseData.data.account.token = account.generateSessionKey();
|
||||
responseData.data.account.email = account.getEmail();
|
||||
} else {
|
||||
responseData.retcode = -201;
|
||||
responseData.message = "Username not found.";
|
||||
}
|
||||
} else {
|
||||
// Account was found, log the player in
|
||||
responseData.message = "OK";
|
||||
responseData.data.account.uid = account.getId();
|
||||
responseData.data.account.token = account.generateSessionKey();
|
||||
|
Loading…
Reference in New Issue
Block a user