diff --git a/fir_client/src/components/user/FirSuperSignBase.vue b/fir_client/src/components/user/FirSuperSignBase.vue index 1df8175..d6c2704 100644 --- a/fir_client/src/components/user/FirSuperSignBase.vue +++ b/fir_client/src/components/user/FirSuperSignBase.vue @@ -147,7 +147,7 @@ diff --git a/fir_ser/api/utils/app/iossignapi.py b/fir_ser/api/utils/app/iossignapi.py index 2083d19..8fe6282 100644 --- a/fir_ser/api/utils/app/iossignapi.py +++ b/fir_ser/api/utils/app/iossignapi.py @@ -202,6 +202,21 @@ class AppDeveloperApiV2(object): result['return_info'] = "%s" % e return False, result + def get_cert_obj_by_cid(self, cert_id): + result = {} + try: + apple_obj = AppStoreConnectApi(self.issuer_id, self.private_key_id, self.p8key) + cert_obj = apple_obj.get_certificate_by_cid(cert_id) + if cert_obj and cert_obj.id: + return True, result + else: + logger.info("ios developer get cert %s failed" % cert_id) + return False, result + except Exception as e: + logger.error("ios developer get cert %s Failed Exception:%s" % (cert_id, e)) + result['return_info'] = "%s" % e + return False, result + def revoke_cert(self, cert_id): result = {} try: diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index 1e7bf0a..97363a7 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -737,6 +737,17 @@ class IosUtils(object): certid=None, cert_expire_time=None) return status, result + @staticmethod + def check_developer_cert(developer_obj,user_obj): + auth = get_auth_form_developer(developer_obj) + app_api_obj = get_api_obj(auth) + status, result = app_api_obj.get_cert_obj_by_cid(developer_obj.certid) + if not status: + AppIOSDeveloperInfo.objects.filter(user_id=user_obj, issuer_id=auth.get("issuer_id")).update( + certid=None, cert_expire_time=None) + return status, result + + @staticmethod def auto_get_certid_by_p12(developer_obj, user_obj): auth = get_auth_form_developer(developer_obj) diff --git a/fir_ser/api/views/supersign.py b/fir_ser/api/views/supersign.py index a65dc5d..dcf8bc6 100644 --- a/fir_ser/api/views/supersign.py +++ b/fir_ser/api/views/supersign.py @@ -67,11 +67,13 @@ class DeveloperView(APIView): if act: res = BaseResponse() logger.info("user %s iosdeveloper %s act %s" % (request.user, developer_obj, act)) - if act == "preactive": + if act == "checkauth": status, result = IosUtils.active_developer(developer_obj) if status: if not developer_obj.certid: IosUtils.get_device_from_developer(developer_obj, request.user) + else: + IosUtils.check_developer_cert(developer_obj, request.user) return self.get(request) else: res.code = 1008 @@ -111,14 +113,6 @@ class DeveloperView(APIView): res.code = 1008 res.msg = result.get("err_info") return Response(res.dict) - elif act == "checkauth": - status, result = IosUtils.active_developer(developer_obj) - if status: - return self.get(request) - else: - res.code = 1008 - res.msg = result.get("return_info") - return Response(res.dict) else: logger.info("user %s iosdeveloper %s update input data %s" % (request.user, developer_obj, data)) logger.info("user %s iosdeveloper %s update old data %s" % (