返回提交历史
Modified
src/services/loginService.ts
+2
-5
XFEstudio/SpaceNinjaServer
chore: don't validate Nonce in query (#1341)
By asking MongoDB to simply find the account by the ID and then validating the nonce ourselves, we save roughly 1ms. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1341
a6223939
代码差异
1 个文件
+2
-5
@@ -74,11 +74,8 @@ export const getAccountForRequest = async (req: Request): Promise<TAccountDocume
74
74
throw new Error("Request is missing nonce parameter");
75
75
}
76
76
77
const account = await Account.findOne({
78
_id: req.query.accountId,
79
Nonce: nonce
80
});
81
if (!account) {
77
const account = await Account.findById(req.query.accountId);
78
if (!account || account.Nonce != nonce) {
82
79
throw new Error("Invalid accountId-nonce pair");
83
80
}
84
81
if (account.Dropped && req.query.ct) {