Skip to content

Commit

Permalink
chore: 优化重复注册 (Close #75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerwin committed Apr 26, 2023
1 parent 9e2fcf4 commit 65d6f33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,13 @@ router.post('/user-register', async (req, res) => {

const user = await getUser(username)
if (user != null) {
res.send({ status: 'Fail', message: '邮箱已存在 | The email exists', data: null })
if (user.status === Status.PreVerify) {
await sendVerifyMail(username, await getUserVerifyUrl(username))
throw new Error('请去邮箱中验证 | Please verify in the mailbox')
}
if (user.status === Status.AdminVerify)
throw new Error('请等待管理员开通 | Please wait for the admin to activate')
res.send({ status: 'Fail', message: '账号已存在 | The email exists', data: null })
return
}
const newPassword = md5(password)
Expand Down Expand Up @@ -556,7 +562,7 @@ router.post('/verify', async (req, res) => {
const username = await checkUserVerify(token)
const user = await getUser(username)
if (user != null && user.status === Status.Normal) {
res.send({ status: 'Fail', message: '邮箱已存在 | The email exists', data: null })
res.send({ status: 'Fail', message: '账号已存在 | The email exists', data: null })
return
}
const config = await getCacheConfig()
Expand Down
1 change: 1 addition & 0 deletions src/views/chat/components/Message/Text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import mila from 'markdown-it-link-attributes'
import hljs from 'highlight.js'
import { useBasicLayout } from '@/hooks/useBasicLayout'
import { t } from '@/locales'
import { copyToClip } from '@/utils/copy'
interface Props {
inversion?: boolean
Expand Down

0 comments on commit 65d6f33

Please sign in to comment.