Skip to content

Commit 65d6f33

Browse files
author
Kerwin
committed
chore: 优化重复注册 (Close #75)
1 parent 9e2fcf4 commit 65d6f33

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

service/src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,13 @@ router.post('/user-register', async (req, res) => {
417417

418418
const user = await getUser(username)
419419
if (user != null) {
420-
res.send({ status: 'Fail', message: '邮箱已存在 | The email exists', data: null })
420+
if (user.status === Status.PreVerify) {
421+
await sendVerifyMail(username, await getUserVerifyUrl(username))
422+
throw new Error('请去邮箱中验证 | Please verify in the mailbox')
423+
}
424+
if (user.status === Status.AdminVerify)
425+
throw new Error('请等待管理员开通 | Please wait for the admin to activate')
426+
res.send({ status: 'Fail', message: '账号已存在 | The email exists', data: null })
421427
return
422428
}
423429
const newPassword = md5(password)
@@ -556,7 +562,7 @@ router.post('/verify', async (req, res) => {
556562
const username = await checkUserVerify(token)
557563
const user = await getUser(username)
558564
if (user != null && user.status === Status.Normal) {
559-
res.send({ status: 'Fail', message: '邮箱已存在 | The email exists', data: null })
565+
res.send({ status: 'Fail', message: '账号已存在 | The email exists', data: null })
560566
return
561567
}
562568
const config = await getCacheConfig()

src/views/chat/components/Message/Text.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import mila from 'markdown-it-link-attributes'
66
import hljs from 'highlight.js'
77
import { useBasicLayout } from '@/hooks/useBasicLayout'
88
import { t } from '@/locales'
9+
import { copyToClip } from '@/utils/copy'
910
1011
interface Props {
1112
inversion?: boolean

0 commit comments

Comments
 (0)