修改访问设置

This commit is contained in:
lzh
2022-04-28 18:10:19 +08:00
parent feca151a68
commit 3ce62867c0
3 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ SECRET_KEY = 'yvolr8nvtga=6p!=0g+#8vbpq98xf-0do=cbt#crl$6b^)$qm4'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["localhost","127.0.0.1"]
LOG_DIR = os.path.join(BASE_DIR, "logs")
if not os.path.exists(LOG_DIR):
+7 -3
View File
@@ -88,7 +88,11 @@ def send_code(request):
'''
注册发送验证码
'''
postBody = json.loads(request.body)
email = postBody.get("email")
flag = sendCode(email)
msg = ""
try:
postBody = json.loads(request.body)
email = postBody.get("email")
flag = sendCode(email)
except Exception as e:
msg = "请先在服务器配置smtp"
return JsonResponse({"msg": flag}, status=200)
+1 -1
View File
@@ -25,7 +25,7 @@ class EmailService():
self.temp_collection = self.mydb["temp"]
self.valid_time = 60 * 5
def send_email(self, to_addr, password='htvviggqfrwobbfc'):
def send_email(self, to_addr, password=''):
'''
:param password: Email authorization code
:param to_addr: recevier email address