email注册时增加判断
This commit is contained in:
parent
58e7c713ed
commit
88a17b515b
@ -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 }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user