From 88a17b515b570427cb1a89618f5b2facfca996c1 Mon Sep 17 00:00:00 2001 From: zhl Date: Mon, 8 May 2023 17:34:06 +0800 Subject: [PATCH] =?UTF-8?q?email=E6=B3=A8=E5=86=8C=E6=97=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/mail.controller.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controllers/mail.controller.ts b/src/controllers/mail.controller.ts index 5df985a..78a2e46 100644 --- a/src/controllers/mail.controller.ts +++ b/src/controllers/mail.controller.ts @@ -117,6 +117,12 @@ class MailController extends BaseController { throw new ZError(10, 'params mismatch') } type = parseInt(type) + if (type === CodeType.REGIST) { + let account = await Account.findByEmail(email) + if (account) { + throw new ZError(11, 'account exists') + } + } let record = await CodeRecord.findByEmail(email, type) if (!record) { record = new CodeRecord({ email, type, code: DEFAULT_CODE }) @@ -158,6 +164,6 @@ class MailController extends BaseController { throw new ZError(10, 'params mismatch') } let account = await Account.findByEmail(email) - return { exists: !account } + return { exists: !!account } } }