绑定游戏帐号时, 增加验证

This commit is contained in:
CounterFire2023 2024-05-15 20:12:32 +08:00
parent 62af6b9332
commit d52ceb5e83

View File

@ -82,7 +82,13 @@ class MailController extends BaseController {
}
const openId = recordCode.openId
let userCheck = await ActivityUser.findOne({ clientId: openId, clientPlat: recordCode.plat })
if (userCheck && userCheck.id !== user.id) {
let userCheck2 = await ActivityUser.findOne({ googleId: openId })
let userCheck3 = await ActivityUser.findOne({ emailId: openId })
if (
(userCheck && userCheck.id !== user.id) ||
(userCheck2 && userCheck2.id !== user.id) ||
(userCheck3 && userCheck3.id !== user.id)
) {
throw new ZError(13, 'Email already binded to another account')
}
user.clientId = openId