diff --git a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java index f7a4b6ea33..4729dcb089 100644 --- a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java +++ b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java @@ -7,6 +7,7 @@ import io.dataease.auth.service.AuthUserService; import io.dataease.auth.util.JWTUtils; import io.dataease.commons.utils.CommonBeanFactory; import io.dataease.commons.utils.ServletUtils; +import io.dataease.i18n.Translator; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.subject.Subject; @@ -26,7 +27,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { private Logger LOGGER = LoggerFactory.getLogger(this.getClass()); - public final static String expireMessage = "login token is expire"; + public final static String expireMessage = "Login token is expire."; /*@Autowired private AuthUserService authUserService;*/ @@ -102,6 +103,9 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { TokenInfo tokenInfo = JWTUtils.tokenInfoByToken(token); AuthUserService authUserService = CommonBeanFactory.getBean(AuthUserService.class); SysUserEntity user = authUserService.getUserById(tokenInfo.getUserId()); + if(user == null){ + throw new Exception(Translator.get("i18n_not_find_user")); + } String password = user.getPassword(); // 删除老token操作时间 diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 7bf0bf2b15..06784d2f0f 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -244,3 +244,4 @@ i18n_username_exists=ID is already exists i18n_ds_name_exists=Datasource name exists i18n_sync_job_exists=There is already a synchronization task running, please try again later i18n_datasource_check_fail=Invalid,please check config +i18n_not_find_user=Can not find user. \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 6ef78e0a4f..a6e9f29685 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -232,8 +232,8 @@ i18n_template_system=系统模板 i18n_template_self=用户模板 i18n_name_cant_repeat_same_group=同一分组下名称不能重复 i18n_chart_count=记录数* -i18n_excel_have_merge_region=Excel存在合并单元格 -i18n_cron_expression_error=Cron表达式校验错误 +i18n_excel_have_merge_region=Excel 存在合并单元格 +i18n_cron_expression_error=Cron 表达式校验错误 i18n_same_folder_can_not_repeat=相同的目录下名称不能重复 i18n_default_panel=默认仪表板 i18n_panel_list=仪表板 @@ -242,7 +242,8 @@ i18n_union_already_exists=关联关系已存在 i18n_union_field_exists=两个数据集之间关联不能出现多次相同字段 i18n_cron_time_error=开始时间不能大于结束时间 i18n_auth_source_be_canceled=当前资源授权权限已经被取消 -i18n_username_exists=用户ID已存在 +i18n_username_exists=用户 ID 已存在 i18n_ds_name_exists=数据源名称已存在 i18n_sync_job_exists=已经有同步任务在运行,稍后重试 i18n_datasource_check_fail=校验失败,请检查配置信息 +i18n_not_find_user=未找到用户 \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index fe3e55190d..55266c1429 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -246,3 +246,4 @@ i18n_username_exists=用戶ID已存在 i18n_ds_name_exists=數據源名稱已存在 i18n_sync_job_exists=已經有同步任務在運行,稍後重試 i18n_datasource_check_fail=校驗失敗,請檢查配置信息 +i18n_not_find_user=未找到用戶 \ No newline at end of file diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 2c9e49c281..97f3465a40 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -268,6 +268,10 @@ export default { not_equals: 'Not equals', between: 'between', current_user: 'Current User' + }, + message_box: { + alert: 'Alert', + confirm: 'Confirm' } }, monitor: 'Monitor', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index cede5bd3a4..41323c3948 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -83,8 +83,8 @@ export default { thirdpartyTips: '本地不能模拟,请结合自己业务进行模拟!!!', expires: '登陸信息过期,请重新登陸', tokenError: '信息错误,请重新登陸', - username_error: '請輸入正確的ID', - password_error: '密碼不小於8位' + username_error: '請輸入正確的 ID', + password_error: '密碼不小於 8 位' }, commons: { close: '关闭', @@ -268,6 +268,10 @@ export default { not_equals: '不等與', between: '之间', current_user: '是当前用戶' + }, + message_box: { + alert: '警告', + confirm: '確認' } }, monitor: '监控', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 37f3874bdf..0a21ff9ab8 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -81,10 +81,10 @@ export default { any: '随便填', thirdparty: '第三方登录', thirdpartyTips: '本地不能模拟,请结合自己业务进行模拟!!!', - expires: '登录token过期,请重新登录', - tokenError: 'token错误,请重新登录', - username_error: '请输入正确的ID', - password_error: '密码不小于8位' + expires: '登录信息过期,请重新登录', + tokenError: '登陆信息错误,请重新登录', + username_error: '请输入正确的 ID', + password_error: '密码不小于 8 位' }, commons: { close: '关闭', @@ -268,6 +268,10 @@ export default { not_equals: '不等于', between: '之间', current_user: '是当前用户' + }, + message_box: { + alert: '警告', + confirm: '确认' } }, monitor: '监控', diff --git a/frontend/src/utils/message.js b/frontend/src/utils/message.js index 6fb5c6d1cc..fd72e88a30 100644 --- a/frontend/src/utils/message.js +++ b/frontend/src/utils/message.js @@ -1,7 +1,7 @@ import { MessageBox, Message } from 'element-ui' import i18n from '@/lang' export const $alert = (message, callback, options) => { - const title = i18n.t('common.message_box.alert') + const title = i18n.t('commons.message_box.alert') MessageBox.alert(message, title, options).then(() => { callback() }) @@ -14,7 +14,7 @@ export const $confirm = (message, callback, options = {}) => { type: 'warning', ...options } - const title = i18n.t('common.message_box.confirm') + const title = i18n.t('commons.message_box.confirm') MessageBox.confirm(message, title, defaultOptions).then(() => { callback() })