fix 账号登录

This commit is contained in:
lxy 2024-08-23 17:10:15 +08:00
parent 65b4eeda34
commit 0da94cb76c
1 changed files with 4 additions and 4 deletions

View File

@ -751,7 +751,7 @@ export async function loginByAccount<ED extends EntityDict>(
case 1: {
const [userRow] = result;
const { mobile$user, email$user, loginName$user, id: userId, } = userRow;
if (mobile$user && mobile$user.length > 0) {
if (mobile$user && mobile$user.length > 0 && account === mobile$user[0].mobile) {
const ableState = mobile$user[0].ableState;
if (ableState === 'disabled') {
// 虽然密码和手机号匹配,但手机号已经禁用了,在可能的情况下提醒用户使用其它方法登录
@ -764,7 +764,7 @@ export async function loginByAccount<ED extends EntityDict>(
}
}
return await setupMobile<ED>(account, env, context);
} else if (email$user && email$user.length > 0) {
} else if (email$user && email$user.length > 0 && account === email$user[0].email) {
const ableState = email$user[0].ableState;
if (ableState === 'disabled') {
// 虽然密码和邮箱匹配,但邮箱已经禁用了,在可能的情况下提醒用户使用其它方法登录
@ -777,10 +777,10 @@ export async function loginByAccount<ED extends EntityDict>(
}
}
return await setupEmail<ED>(account, env, context);
} else if (loginName$user && loginName$user.length > 0) {
} else if (loginName$user && loginName$user.length > 0 && account === loginName$user[0].name) {
const ableState = loginName$user[0].ableState;
if (ableState === 'disabled') {
// 虽然密码和邮箱匹配,但邮箱已经禁用了,在可能的情况下提醒用户使用其它方法登录
// 虽然密码和账号匹配,但账号已经禁用了,在可能的情况下提醒用户使用其它方法登录
const exception = await tryMakeChangeLoginWay<ED>(
userId as string,
context