Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -38,11 +38,15 @@ def CustomExceptionHandler(ex, context):
|
|||||||
# 调用默认的异常处理函数
|
# 调用默认的异常处理函数
|
||||||
response = exception_handler(ex, context)
|
response = exception_handler(ex, context)
|
||||||
if isinstance(ex, AuthenticationFailed):
|
if isinstance(ex, AuthenticationFailed):
|
||||||
|
# 如果是身份验证错误
|
||||||
|
if response and response.data.get('detail') == "Given token not valid for any token type":
|
||||||
code = 401
|
code = 401
|
||||||
code_type = response.data.get('detail').code
|
msg = ex.detail
|
||||||
if code_type == 'no_active_account':
|
elif response and response.data.get('detail') == "Token is blacklisted":
|
||||||
code=400
|
# token在黑名单
|
||||||
return ErrorResponse(status=HTTP_401_UNAUTHORIZED)
|
return ErrorResponse(status=HTTP_401_UNAUTHORIZED)
|
||||||
|
else:
|
||||||
|
code = 401
|
||||||
msg = ex.detail
|
msg = ex.detail
|
||||||
elif isinstance(ex,Http404):
|
elif isinstance(ex,Http404):
|
||||||
code = 400
|
code = 400
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ export default {
|
|||||||
two4: 'Links',
|
two4: 'Links',
|
||||||
},
|
},
|
||||||
account: {
|
account: {
|
||||||
accountPlaceholder1: 'The user name admin or not is common',
|
accountPlaceholder1: 'Please enter your login account',
|
||||||
accountPlaceholder2: 'Password: 123456',
|
accountPlaceholder2: 'Please enter your login password',
|
||||||
accountPlaceholder3: 'Please enter the verification code',
|
accountPlaceholder3: 'Please enter the verification code',
|
||||||
accountBtnText: 'Sign in',
|
accountBtnText: 'Sign in',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ export default {
|
|||||||
two4: '友情链接',
|
two4: '友情链接',
|
||||||
},
|
},
|
||||||
account: {
|
account: {
|
||||||
accountPlaceholder1: '用户名 admin 或不输均为 common',
|
accountPlaceholder1: '请输入登录账号',
|
||||||
accountPlaceholder2: '密码:123456',
|
accountPlaceholder2: '请输入登录密码',
|
||||||
accountPlaceholder3: '请输入验证码',
|
accountPlaceholder3: '请输入验证码',
|
||||||
accountBtnText: '登 录',
|
accountBtnText: '登 录',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ export default {
|
|||||||
two4: '友情連結',
|
two4: '友情連結',
|
||||||
},
|
},
|
||||||
account: {
|
account: {
|
||||||
accountPlaceholder1: '用戶名admin或不輸均為common',
|
accountPlaceholder1: '請輸入登入賬號',
|
||||||
accountPlaceholder2: '密碼:123456',
|
accountPlaceholder2: '請輸入登入密碼',
|
||||||
accountPlaceholder3: '請輸入驗證碼',
|
accountPlaceholder3: '請輸入驗證碼',
|
||||||
accountBtnText: '登入',
|
accountBtnText: '登入',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ function createService() {
|
|||||||
case 401:
|
case 401:
|
||||||
Local.clear();
|
Local.clear();
|
||||||
Session.clear();
|
Session.clear();
|
||||||
dataAxios.msg = '登录授权过期,请重新登录';
|
dataAxios.msg = '登录认证失败,请重新登录';
|
||||||
ElMessageBox.alert(dataAxios.msg, '提示', {
|
ElMessageBox.alert(dataAxios.msg, '提示', {
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
callback: (action: Action) => {
|
callback: (action: Action) => {
|
||||||
@@ -100,7 +100,15 @@ function createService() {
|
|||||||
error.message = '请求错误';
|
error.message = '请求错误';
|
||||||
break;
|
break;
|
||||||
case 401:
|
case 401:
|
||||||
error.message = '未授权,请登录';
|
Local.clear();
|
||||||
|
Session.clear();
|
||||||
|
error.message = '登录授权过期,请重新登录';
|
||||||
|
ElMessageBox.alert(error.message, '提示', {
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
callback: (action: Action) => {
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
})
|
||||||
break;
|
break;
|
||||||
case 403:
|
case 403:
|
||||||
error.message = '拒绝访问';
|
error.message = '拒绝访问';
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const websocket: socket = {
|
|||||||
}
|
}
|
||||||
const token = Session.get('token')
|
const token = Session.get('token')
|
||||||
if(!token){
|
if(!token){
|
||||||
message.warning('websocket认证失败')
|
// message.warning('websocket认证失败')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const wsUrl = `${getWsBaseURL()}ws/${token}/`
|
const wsUrl = `${getWsBaseURL()}ws/${token}/`
|
||||||
|
|||||||
Reference in New Issue
Block a user