上线前支持不填验证码直接登录
This commit is contained in:
@@ -92,20 +92,25 @@ export default class Auth extends Service {
|
|||||||
if (telVerify.status !== 0) {
|
if (telVerify.status !== 0) {
|
||||||
return telVerify;
|
return telVerify;
|
||||||
}
|
}
|
||||||
if (!isString(code) || code.length !== 6) {
|
|
||||||
return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 手机验证码核验
|
// ! 测试阶段允许客户端不传验证码,此时不做验证码验证,直接注册或登录账号
|
||||||
const smsValid: boolean = await smsModel.validateSms(tel, code);
|
// TODO 上线前改掉或仅保留在测试服
|
||||||
if (!smsValid) {
|
if (code !== '') {
|
||||||
const sms = await smsModel.findByTel(tel);
|
if (!isString(code) || code.length !== 6) {
|
||||||
if(sms && sms.isFixed) { // 固定手机号登录
|
return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||||
if (sms.code !== code) {
|
}
|
||||||
|
|
||||||
|
// 手机验证码核验
|
||||||
|
const smsValid: boolean = await smsModel.validateSms(tel, code);
|
||||||
|
if (!smsValid) {
|
||||||
|
const sms = await smsModel.findByTel(tel);
|
||||||
|
if(sms && sms.isFixed) { // 固定手机号登录
|
||||||
|
if (sms.code !== code) {
|
||||||
|
return ctx.service.utils.resResult(STATUS.SMS_INVALID);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
return ctx.service.utils.resResult(STATUS.SMS_INVALID);
|
return ctx.service.utils.resResult(STATUS.SMS_INVALID);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return ctx.service.utils.resResult(STATUS.SMS_INVALID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user