#新媒体舆情

This commit is contained in:
Bob 2020-08-29 10:23:02 +08:00
parent c62a91992e
commit 09871d14cf
1 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,8 @@ from django_token.models import Token
import datetime
from .models import VerifyCode
from .utils import generate_code, send_sms_code
#这个地方sent_sms_code原先是send_sms_code报错
from .utils import generate_code, sent_sms_code
def index(request):
@ -71,7 +72,7 @@ def send_code(request):
code = generate_code()
now = datetime.datetime.now()
after_10mins = now + datetime.timedelta(minutes=10)
response = send_sms_code(phone, code)
response = sent_sms_code(phone, code)
result = response.decode('utf8')
if "OK" in result:
VerifyCode.objects.create(code=code, phone=phone, category=category)
@ -141,4 +142,4 @@ def password_recover_step_two(request):
if not user:
return JsonResponse({'status': 'error', 'message': '用户名不存在'})
user.set_password(password)
return JsonResponse({'status': 'success', 'message': {phone: phone}})
return JsonResponse({'status': 'success', 'message': {phone: phone}})