修复设置域名bug

super_signature
nineven 5 years ago
parent c0296619cc
commit 96394cbece
  1. 4
      fir_client/src/components/FirApps.vue
  2. 2
      fir_client/src/components/FirUserProfileInfo.vue
  3. 21
      fir_ser/api/views/login.py

@ -178,7 +178,7 @@
</el-radio-group>
</el-col>
<el-col :span="4">
<el-col :span="5">
<el-row>
<el-col :span="20">
<el-input
@ -199,7 +199,7 @@
<!-- -->
<!-- </el-col>-->
<el-col :span="7" class="surplus-card">
<el-col :span="8" class="surplus-card">
<el-row>
<el-col :span="8">
<div>

@ -130,7 +130,7 @@
this.$message.success("更新成功")
}
} else {
this.$message.error("更新失败")
this.$message.error("更新失败 "+data.msg)
}
}, datainfo)

@ -11,8 +11,8 @@ from api.utils.TokenManager import DownloadToken, generateNumericTokenOfLength
from api.utils.auth import ExpiringTokenAuthentication
from api.utils.response import BaseResponse
from django.middleware import csrf
from fir_ser.settings import CACHE_KEY_TEMPLATE
from api.utils.storage.caches import login_auth_failed, del_cache_storage, set_default_app_wx_easy
from fir_ser.settings import CACHE_KEY_TEMPLATE, SERVER_DOMAIN
from api.utils.storage.caches import login_auth_failed, set_default_app_wx_easy
import logging
logger = logging.getLogger(__name__)
@ -131,9 +131,20 @@ class UserInfoView(APIView):
else:
# 修改个人资料
domain_name = data.get("domain_name", None)
if domain_name and len(domain_name.strip(' ')) > 3:
request.user.domain_name = domain_name.strip(' ')
set_default_app_wx_easy(request.user)
if domain_name:
domain_name_list = domain_name.strip(' ').strip("http://").strip("https://").split("/")
if len(domain_name_list) > 1:
domain_name = domain_name_list[0]
if len(domain_name) > 3:
if domain_name == SERVER_DOMAIN.get("REDIRECT_UDID_DOMAIN").split("//")[1]:
serializer = UserInfoSerializer(request.user)
res.data = serializer.data
res.code = 1004
res.msg = "域名设置失败,请更换其他域名"
return Response(res.dict)
else:
request.user.domain_name = domain_name
set_default_app_wx_easy(request.user)
if domain_name == '':
request.user.domain_name = None

Loading…
Cancel
Save