bugfix
This commit is contained in:
parent
cfbe37f2b6
commit
e0c7596444
24
wwwroot/gen_sms_code.dspy
Normal file
24
wwwroot/gen_sms_code.dspy
Normal file
@ -0,0 +1,24 @@
|
||||
phone = params_kw.cellphone
|
||||
if phone is None:
|
||||
return {
|
||||
"status": "error",
|
||||
"data":{
|
||||
"message": "没有收到手机号"
|
||||
}
|
||||
}
|
||||
# 使用短信模块发布的sms_engine实例生成验证码,参数手机号
|
||||
status, timeout = await sms_engine.generate_sms_code(phone)
|
||||
if not status:
|
||||
return {
|
||||
status": "error",
|
||||
"data": {
|
||||
message": f'为{phone}生成的手机号出错"
|
||||
}
|
||||
}
|
||||
return {
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"message": “短信码已生成",
|
||||
"timeout": timeout
|
||||
}
|
||||
}
|
||||
25
wwwroot/phone_login.dspy
Normal file
25
wwwroot/phone_login.dspy
Normal file
@ -0,0 +1,25 @@
|
||||
# 用短信模块检查验证码是否正确
|
||||
if params_kw.cellphone:
|
||||
return {
|
||||
"status": "error",
|
||||
"data":{
|
||||
"message": "需输入手机号"
|
||||
}
|
||||
}
|
||||
if params_kw.sms_code is None:
|
||||
return {
|
||||
"status": "error",
|
||||
"data": {
|
||||
"message": "需输入验证码"
|
||||
}
|
||||
}
|
||||
f = await sms_engine.check_sms_code(params_kw.cellphone, params_kw.sms_code)
|
||||
if not f:
|
||||
return {
|
||||
"status": "error",
|
||||
"data": {
|
||||
"message": "手机短信验证码出错"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user