Эх сурвалжийг харах

Merge remote-tracking branch 'remotes/origin/dev' into test

tanghongbin 4 жил өмнө
parent
commit
518d2c9a16

+ 7 - 3
Controller/UserController.py

@@ -3342,12 +3342,13 @@ class AppleAuthLogin(View):
 
         response = ResponseObject(lang)
         identity_token = CommonService.decode_data(identity_token)
+        # print(identity_token)
         if identity_token:
             key_url = 'https://appleid.apple.com/auth/keys'
             key_response = requests.get(key_url).json()
-            print(key_response)
+            # print(key_response)
             head = jwt.get_unverified_header(identity_token)
-            print(head)
+            # print(head)
             token_key = head['kid']
             key_object = None
             alg = None
@@ -3373,7 +3374,10 @@ class AppleAuthLogin(View):
                     else:
                         # 如果用户为绑定过则创建用户并进行登录返回token
                         userID = CommonService.getUserID(getUser=False)
-                        nickname = claims['email']
+                        if claims.__contains__('email'):
+                            nickname = claims['email']
+                        else:
+                            nickname = 'apple_{num}'.format(num=CommonService.RandomStr(6, False))
                         return self.do_register(userID, nickname, response, app_bundle_id, unionID)
 
                 except Exception as e: