From d943b5527db0d1b0f6696f070af67d77b1a6993c Mon Sep 17 00:00:00 2001 From: youngS Date: Wed, 10 Nov 2021 10:16:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/views/apps.py | 2 +- fir_ser/api/views/download.py | 12 ++++++------ fir_ser/api/views/login.py | 11 ++++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/fir_ser/api/views/apps.py b/fir_ser/api/views/apps.py index d479077..62348f7 100644 --- a/fir_ser/api/views/apps.py +++ b/fir_ser/api/views/apps.py @@ -181,7 +181,7 @@ class AppInfoView(APIView): app_obj.supersign_limit_number = data.get("supersign_limit_number", app_obj.supersign_limit_number) app_obj.isshow = data.get("isshow", app_obj.isshow) - update_fields = ["description", "short", "name", "password", "supersign_limit_number"] + update_fields = ["description", "short", "name", "password", "supersign_limit_number", "isshow"] if get_user_domain_name(request.user) or get_app_domain_name(app_obj): app_obj.wxeasytype = data.get("wxeasytype", app_obj.wxeasytype) else: diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py index 976afbc..b861335 100644 --- a/fir_ser/api/views/download.py +++ b/fir_ser/api/views/download.py @@ -156,12 +156,6 @@ class ShortDownloadView(APIView): return Response(res.dict) domain_name = get_redirect_server_domain(request, user_obj, get_app_domain_name(app_obj)) origin_domain_name = get_origin_domain_name(request) - if domain_name.split('//')[-1].split('/')[0] != origin_domain_name: - res.code = 1000 - res.domain_name = domain_name - res.redirect = True - res.data = format_get_uri(domain_name, short, {'release_id': release_id, 'udid': udid}) - return Response(res.dict) if user_obj and user_obj.role and user_obj.role == 3: ... @@ -171,6 +165,12 @@ class ShortDownloadView(APIView): res.code = 1004 res.msg = "访问域名不合法" return Response(res.dict) + if domain_name.split('//')[-1].split('/')[0] != origin_domain_name: + res.code = 1000 + res.domain_name = domain_name + res.redirect = True + res.data = format_get_uri(domain_name, short, {'release_id': release_id, 'udid': udid}) + return Response(res.dict) if udid: if not app_obj.issupersign: res.code = 1002 diff --git a/fir_ser/api/views/login.py b/fir_ser/api/views/login.py index 62e8bd4..2eec3e9 100644 --- a/fir_ser/api/views/login.py +++ b/fir_ser/api/views/login.py @@ -18,7 +18,7 @@ from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle, G from api.utils.utils import get_captcha, valid_captcha, \ get_sender_sms_token, is_valid_sender_code, get_sender_email_token, get_random_username, \ check_username_exists, set_user_token, clean_user_token_and_cache -from fir_ser.settings import REGISTER, LOGIN, CHANGER, REPORT, NEW_USER_GIVE_DOWNLOAD_TIMES +from fir_ser.settings import LOGIN, CHANGER, REPORT, NEW_USER_GIVE_DOWNLOAD_TIMES, REGISTER logger = logging.getLogger(__name__) @@ -619,11 +619,12 @@ class AuthorizationView(APIView): res.code = 1008 res.msg = "邀请码已失效" return Response(res.dict) - if ext and ext.get('report'): - REGISTER = REPORT + p_data = REPORT + else: + p_data = REGISTER - if REGISTER.get("captcha"): + if p_data.get("captcha"): is_valid = valid_captcha(ext.get("captcha_key", None), ext.get("authcode", None), target) if ext and is_valid: pass @@ -632,7 +633,7 @@ class AuthorizationView(APIView): res.msg = "图片验证码有误" return Response(res.dict) - if REGISTER.get("geetest"): + if p_data.get("geetest"): geetest = request.data.get("geetest", None) if geetest and second_validate(geetest).get("result", "") == "success": pass