Browse Source

Merge branch 'dev' of http://192.168.136.45:3000/SERVER/AnsjerServer into dev

chanjunkai 5 năm trước cách đây
mục cha
commit
ed9e630c3a
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      Controller/UserController.py

+ 2 - 2
Controller/UserController.py

@@ -42,6 +42,7 @@ import random
 from io import BytesIO
 from PIL import Image, ImageDraw, ImageFont
 from django.shortcuts import HttpResponse
+from Ansjer.config import BASE_DIR
 
 
 # 获取验证码
@@ -2309,7 +2310,7 @@ class generatePictureCodeView(TemplateView):
 
         # --------生成随机验证码,设置字体格式,大小等属性------------
         draw = ImageDraw.Draw(img)
-        path = "../Ansjer/file/font/simhei.ttf"
+        path = BASE_DIR + '/Ansjer/file/font/simhei.ttf'
         kumo_font = ImageFont.truetype(path, 40, encoding="unic")  # 设置字体
         print("字体可以")
         valid_code_str = ''
@@ -2432,7 +2433,6 @@ class Image_Code_RegisterView(TemplateView):
         if image_code_key is None:
             return response.json(120)
         redisObj = RedisObject(db=6)
-
         #redis里面的验证码
         redis_image_code = redisObj.get_data(key=image_code_key)
         #验证用户输入的验证码和redis中的验证码