XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

chore: don't allow auto-account creation with an empty password (#4070)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4070 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

4dea0c65
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +10 -5
Modified src/controllers/api/loginController.ts +10 -5
@@ -72,11 +72,16 @@ export const loginController: RequestHandler = async (request, response) => {
72 72 }
73 73 }
74 74
75 if (
76 !account &&
77 ((config.autoCreateAccount && loginRequest.ClientType != "webui") ||
78 loginRequest.ClientType == "webui-register")
79 ) {
75 if (!account && config.autoCreateAccount) {
76 // Early versions (~U14) allow login with the password field being empty.
77 if (
78 loginRequest.password ==
79 "19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3"
80 ) {
81 response.status(400).json({ error: "please enter a password ._." });
82 return;
83 }
84
80 85 const name = await getUsernameFromEmail(loginRequest.email);
81 86 const newAccount = await createAccount({
82 87 email: loginRequest.email,