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

This commit is contained in:
H0nGzA1
2023-04-10 00:04:00 +08:00
6 changed files with 26 additions and 14 deletions

View File

@@ -38,11 +38,15 @@ def CustomExceptionHandler(ex, context):
# 调用默认的异常处理函数
response = exception_handler(ex, context)
if isinstance(ex, AuthenticationFailed):
# 如果是身份验证错误
if response and response.data.get('detail') == "Given token not valid for any token type":
code = 401
code_type = response.data.get('detail').code
if code_type == 'no_active_account':
code=400
msg = ex.detail
elif response and response.data.get('detail') == "Token is blacklisted":
# token在黑名单
return ErrorResponse(status=HTTP_401_UNAUTHORIZED)
else:
code = 401
msg = ex.detail
elif isinstance(ex,Http404):
code = 400

View File

@@ -9,8 +9,8 @@ export default {
two4: 'Links',
},
account: {
accountPlaceholder1: 'The user name admin or not is common',
accountPlaceholder2: 'Password: 123456',
accountPlaceholder1: 'Please enter your login account',
accountPlaceholder2: 'Please enter your login password',
accountPlaceholder3: 'Please enter the verification code',
accountBtnText: 'Sign in',
},

View File

@@ -9,8 +9,8 @@ export default {
two4: '友情链接',
},
account: {
accountPlaceholder1: '用户名 admin 或不输均为 common',
accountPlaceholder2: '密码123456',
accountPlaceholder1: '请输入登录账号',
accountPlaceholder2: '请输入登录密码',
accountPlaceholder3: '请输入验证码',
accountBtnText: '登 录',
},

View File

@@ -9,8 +9,8 @@ export default {
two4: '友情連結',
},
account: {
accountPlaceholder1: '用戶名admin或不輸均為common',
accountPlaceholder2: '密碼123456',
accountPlaceholder1: '請輸入登入賬號',
accountPlaceholder2: '請輸入登入密碼',
accountPlaceholder3: '請輸入驗證碼',
accountBtnText: '登入',
},

View File

@@ -70,7 +70,7 @@ function createService() {
case 401:
Local.clear();
Session.clear();
dataAxios.msg = '登录授权过期,请重新登录';
dataAxios.msg = '登录认证失败,请重新登录';
ElMessageBox.alert(dataAxios.msg, '提示', {
confirmButtonText: 'OK',
callback: (action: Action) => {
@@ -100,7 +100,15 @@ function createService() {
error.message = '请求错误';
break;
case 401:
error.message = '未授权,请登录';
Local.clear();
Session.clear();
error.message = '登录授权过期,请重新登录';
ElMessageBox.alert(error.message, '提示', {
confirmButtonText: 'OK',
callback: (action: Action) => {
window.location.reload();
},
})
break;
case 403:
error.message = '拒绝访问';

View File

@@ -30,7 +30,7 @@ const websocket: socket = {
}
const token = Session.get('token')
if(!token){
message.warning('websocket认证失败')
// message.warning('websocket认证失败')
return null
}
const wsUrl = `${getWsBaseURL()}ws/${token}/`