Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
fda20501
Commit
fda20501
authored
Apr 20, 2022
by
Melledy
Browse files
Fix account not found issue when logging in
parent
88e608ad
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
View file @
fda20501
...
@@ -226,7 +226,9 @@ public final class DispatchServer {
...
@@ -226,7 +226,9 @@ public final class DispatchServer {
Account
account
=
DatabaseHelper
.
getAccountByName
(
requestData
.
account
);
Account
account
=
DatabaseHelper
.
getAccountByName
(
requestData
.
account
);
// Check if account exists, else create a new one.
// Check if account exists, else create a new one.
if
(
account
==
null
&&
Grasscutter
.
getConfig
().
ServerOptions
.
AutomaticallyCreateAccounts
)
{
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.
// This account has been created AUTOMATICALLY. There will be no permissions added.
account
=
DatabaseHelper
.
createAccountWithId
(
requestData
.
account
,
0
);
account
=
DatabaseHelper
.
createAccountWithId
(
requestData
.
account
,
0
);
...
@@ -234,10 +236,12 @@ public final class DispatchServer {
...
@@ -234,10 +236,12 @@ public final class DispatchServer {
responseData
.
data
.
account
.
uid
=
account
.
getId
();
responseData
.
data
.
account
.
uid
=
account
.
getId
();
responseData
.
data
.
account
.
token
=
account
.
generateSessionKey
();
responseData
.
data
.
account
.
token
=
account
.
generateSessionKey
();
responseData
.
data
.
account
.
email
=
account
.
getEmail
();
responseData
.
data
.
account
.
email
=
account
.
getEmail
();
}
else
if
(!
Grasscutter
.
getConfig
().
ServerOptions
.
AutomaticallyCreateAccounts
)
{
}
else
{
responseData
.
retcode
=
-
201
;
responseData
.
retcode
=
-
201
;
responseData
.
message
=
"Username not found."
;
responseData
.
message
=
"Username not found."
;
}
}
else
{
}
else
{
// Account was found, log the player in
responseData
.
message
=
"OK"
;
responseData
.
message
=
"OK"
;
responseData
.
data
.
account
.
uid
=
account
.
getId
();
responseData
.
data
.
account
.
uid
=
account
.
getId
();
responseData
.
data
.
account
.
token
=
account
.
generateSessionKey
();
responseData
.
data
.
account
.
token
=
account
.
generateSessionKey
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment