chatgpt-web-dev / chatgpt-web

A third-party ChatGPT Web UI page built with Express and Vue3, through the official OpenAI completion API. / 用 Express 和 Vue3 搭建的第三方 ChatGPT 前端页面, 基于 OpenAI 官方 completion API.
https://chatgpt-web.dev
MIT License
1.56k stars 436 forks source link

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

Closed wp861010 closed 4 months ago

wp861010 commented 4 months ago

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

MAOUXSAKI commented 4 months ago

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

dqzboy commented 4 months ago

同+1

image
MAOUXSAKI commented 4 months ago

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 commented 4 months ago

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

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