|
@@ -26,7 +26,7 @@ from jwt.algorithms import RSAAlgorithm
|
|
|
from ratelimit import limits
|
|
|
|
|
|
from Ansjer.config import AuthCode_Expire, SERVER_DOMAIN, TUTK_PUSH_DOMAIN, \
|
|
|
- LOGGER, CONFIG_US
|
|
|
+ LOGGER, CONFIG_US, APP_MAPPING
|
|
|
from Ansjer.config import BASE_DIR, CONFIG_EUR, CONFIG_INFO, SERVER_DOMAIN_EUR, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
|
|
|
from Controller.CheckUserData import DataValid, date_handler, RandomStr
|
|
|
from Controller.UserDevice.UserSubscriptionController import UserSubscriptionControllerView
|
|
@@ -2369,10 +2369,11 @@ class v3LoginView(TemplateView):
|
|
|
lang = request_dict.get('lang', 'en')
|
|
|
tz = request_dict.get('tz', None)
|
|
|
token_version = request_dict.get('tokenVersion', 'V1')
|
|
|
+ new_bundle = APP_MAPPING.get(app_bundle_id, None)
|
|
|
tko = TokenObject()
|
|
|
res = tko.generate(
|
|
|
data={'userID': userID, 'lang': response.lang, 'user': users['username'], 'm_code': '123413243214',
|
|
|
- 'appBundleId': app_bundle_id, 'tokenVal': token_val, 'tokenVersion': token_version})
|
|
|
+ 'appBundleId': new_bundle, 'tokenVal': token_val, 'tokenVersion': token_version})
|
|
|
if tko.code != 0:
|
|
|
return response.json(tko.code)
|
|
|
if all([app_bundle_id, app_type, push_type, token_val, m_code, tz]):
|
|
@@ -2462,13 +2463,14 @@ class oneClickLoginView(TemplateView):
|
|
|
'password')
|
|
|
# 用户已存在的响应
|
|
|
if user_qs.exists():
|
|
|
+ new_bundle = APP_MAPPING.get(app_bundle_id, None)
|
|
|
tokenObj = TokenObject()
|
|
|
res = tokenObj.generate(
|
|
|
data={
|
|
|
'userID': user_qs[0]['userID'],
|
|
|
'lang': response.lang,
|
|
|
'user': user_qs[0]['username'],
|
|
|
- 'appBundleId': app_bundle_id,
|
|
|
+ 'appBundleId': new_bundle,
|
|
|
'tokenVersion': token_version,
|
|
|
'tokenVal': token_val,
|
|
|
'm_code': '123413243214'
|
|
@@ -2502,13 +2504,14 @@ class oneClickLoginView(TemplateView):
|
|
|
}
|
|
|
users = Device_User.objects.create(**create_data)
|
|
|
|
|
|
+ new_bundle = APP_MAPPING.get(app_bundle_id, None)
|
|
|
tokenObj = TokenObject()
|
|
|
res = tokenObj.generate(
|
|
|
data={
|
|
|
'userID': userID,
|
|
|
'lang': response.lang,
|
|
|
'user': users.username,
|
|
|
- 'appBundleId': app_bundle_id,
|
|
|
+ 'appBundleId': new_bundle,
|
|
|
'm_code': '123413243214'
|
|
|
}
|
|
|
)
|
|
@@ -2876,10 +2879,11 @@ class wxAuthSignView(TemplateView):
|
|
|
now_time = datetime.datetime.utcnow().replace(tzinfo=utc).astimezone(utc)
|
|
|
userID = user_qs[0].userID
|
|
|
print('userID' + userID)
|
|
|
+ new_bundle = APP_MAPPING.get(app_bundle_id, None)
|
|
|
tko = TokenObject()
|
|
|
user_list = user_qs.values("NickName", "userIconUrl", "userIconPath", "username", "userEmail", "phone")
|
|
|
res = tko.generate(data={'userID': userID, 'lang': response.lang, 'user': user_list[0]["username"],
|
|
|
- 'appBundleId': app_bundle_id, 'tokenVal': token_val, 'tokenVersion': token_version})
|
|
|
+ 'appBundleId': new_bundle, 'tokenVal': token_val, 'tokenVersion': token_version})
|
|
|
# 增加角色
|
|
|
user_qs[0].role.add(Role.objects.get(rid=1))
|
|
|
role_dict = ModelService.own_role(userID=userID)
|
|
@@ -4191,8 +4195,9 @@ class Image_Code_RegisterView(TemplateView):
|
|
|
userID = user_qs[0].userID
|
|
|
tko = TokenObject()
|
|
|
user_list = user_qs.values("NickName", "userIconUrl", "userIconPath", "username", "userEmail", "phone")
|
|
|
+ new_bundle = APP_MAPPING.get(app_bundle_id, None)
|
|
|
res = tko.generate(data={'userID': userID, 'lang': response.lang, 'user': user_list[0]["username"],
|
|
|
- 'appBundleId': app_bundle_id, 'tokenVal': token_val, 'tokenVersion': token_version})
|
|
|
+ 'appBundleId': new_bundle, 'tokenVal': token_val, 'tokenVersion': token_version})
|
|
|
# 增加角色
|
|
|
user_qs[0].role.add(Role.objects.get(rid=1))
|
|
|
role_dict = ModelService.own_role(userID=userID)
|
|
@@ -4428,10 +4433,11 @@ class v3LoginByCodeView(View):
|
|
|
'phone', 'password', 'userIconPath')[0]
|
|
|
|
|
|
userID = users['userID']
|
|
|
+ new_bundle = APP_MAPPING.get(app_bundle_id, None)
|
|
|
tko = TokenObject()
|
|
|
res = tko.generate(
|
|
|
data={'userID': userID, 'lang': response.lang, 'user': users['username'], 'tokenVersion': token_version,
|
|
|
- 'm_code': '123413243214', 'appBundleId': app_bundle_id, 'tokenVal': token_val})
|
|
|
+ 'm_code': '123413243214', 'appBundleId': new_bundle, 'tokenVal': token_val})
|
|
|
# 添加用户登录类型
|
|
|
oauth_qs = UserOauth2Model.objects.filter(userID__userID=userID)
|
|
|
auth_type = 0
|
|
@@ -4663,8 +4669,9 @@ class AppleAuthLogin(View):
|
|
|
print('userID' + userID)
|
|
|
tko = TokenObject()
|
|
|
user_list = user_qs.values("NickName", "userIconUrl", "userIconPath", "username", "userEmail", "phone")
|
|
|
+ new_bundle = APP_MAPPING.get(app_bundle_id, None)
|
|
|
res = tko.generate(data={'userID': userID, 'lang': response.lang, 'user': user_list[0]["username"],
|
|
|
- 'appBundleId': app_bundle_id, 'tokenVal': token_val, 'tokenVersion': token_version})
|
|
|
+ 'appBundleId': new_bundle, 'tokenVal': token_val, 'tokenVersion': token_version})
|
|
|
# 增加角色
|
|
|
user_qs[0].role.add(Role.objects.get(rid=1))
|
|
|
role_dict = ModelService.own_role(userID=userID)
|