fix: 刷新token时,校验用户;国际化问题

This commit is contained in:
taojinlong 2021-06-02 13:05:26 +08:00
parent 32a9980178
commit eb39fb744d
8 changed files with 31 additions and 12 deletions

View File

@ -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操作时间

View File

@ -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.

View File

@ -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=未找到用户

View File

@ -246,3 +246,4 @@ i18n_username_exists=用戶ID已存在
i18n_ds_name_exists=數據源名稱已存在
i18n_sync_job_exists=已經有同步任務在運行,稍後重試
i18n_datasource_check_fail=校驗失敗,請檢查配置信息
i18n_not_find_user=未找到用戶

View File

@ -268,6 +268,10 @@ export default {
not_equals: 'Not equals',
between: 'between',
current_user: 'Current User'
},
message_box: {
alert: 'Alert',
confirm: 'Confirm'
}
},
monitor: 'Monitor',

View File

@ -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: '监控',

View File

@ -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: '监控',

View File

@ -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()
})