Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

环境设置ROOT_USER为自己的邮箱,登录提示账户状态异常 #475

Closed
wp861010 opened this issue Mar 12, 2024 · 4 comments · Fixed by #476
Closed

环境设置ROOT_USER为自己的邮箱,登录提示账户状态异常 #475

wp861010 opened this issue Mar 12, 2024 · 4 comments · Fixed by #476

Comments

@wp861010
Copy link

环境设置ROOT_USER为自己的邮箱,使用此邮箱注册之后登录提示账户状态异常,什么问题?

@MAOUXSAKI
Copy link

应该是新增代码导致的bug, 可以先手动去mongodb的gui,把用户status手动改成0就可以了

@dqzboy
Copy link

dqzboy commented Mar 12, 2024

同+1
image

@MAOUXSAKI
Copy link

service\src\storage\mongo.ts
export async function createUser(email: string, password: string, roles?: UserRole[], status?: Status, remark?: string, useAmount?: number, limit_switch?: boolean): Promise {
email = email.toLowerCase()
const userInfo = new UserInfo(email, password)
if (roles && roles.includes(UserRole.Admin))
userInfo.status = Status.Normal
if (status !== null)
userInfo.status = status

userInfo.roles = roles
userInfo.remark = remark
userInfo.useAmount = useAmount
userInfo.limit_switch = limit_switch
await userCol.insertOne(userInfo)
return userInfo
}

这个方法错了,if (status !== null),在创建管理员账号的时候,status没有传,status在这里是undefined,双不等号必须要完全不等才算不等,改成!=就可以了

@BobDu
Copy link
Member

BobDu commented Mar 13, 2024

这个方法错了,if (status !== null),在创建管理员账号的时候,status没有传,status在这里是undefined,双不等号必须要完全不等才算不等,改成!=就可以了

一直没来得及看 感谢感谢。提个PR? @MAOUXSAKI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants