Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
c3e91577
提交
c3e91577
authored
6月 04, 2021
作者:
junjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(fix):登陆校验优化
上级
3b8f9717
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
29 行增加
和
15 行删除
+29
-15
AuthServer.java
...end/src/main/java/io/dataease/auth/server/AuthServer.java
+11
-9
IndexController.java
...src/main/java/io/dataease/controller/IndexController.java
+1
-1
messages_en_US.properties
backend/src/main/resources/i18n/messages_en_US.properties
+2
-0
messages_zh_CN.properties
backend/src/main/resources/i18n/messages_zh_CN.properties
+2
-0
messages_zh_TW.properties
backend/src/main/resources/i18n/messages_zh_TW.properties
+2
-0
en.js
frontend/src/lang/en.js
+3
-1
tw.js
frontend/src/lang/tw.js
+3
-1
zh.js
frontend/src/lang/zh.js
+3
-1
index.vue
frontend/src/views/login/index.vue
+2
-2
没有找到文件。
backend/src/main/java/io/dataease/auth/server/AuthServer.java
浏览文件 @
c3e91577
...
@@ -18,12 +18,14 @@ import io.dataease.commons.utils.ServletUtils;
...
@@ -18,12 +18,14 @@ import io.dataease.commons.utils.ServletUtils;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.display.service.DisPlayXpackService;*/
import io.dataease.plugins.xpack.display.service.DisPlayXpackService;*/
import
io.dataease.i18n.Translator
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.SecurityUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -41,11 +43,11 @@ public class AuthServer implements AuthApi {
...
@@ -41,11 +43,11 @@ public class AuthServer implements AuthApi {
String
password
=
loginDto
.
getPassword
();
String
password
=
loginDto
.
getPassword
();
SysUserEntity
user
=
authUserService
.
getUserByName
(
username
);
SysUserEntity
user
=
authUserService
.
getUserByName
(
username
);
if
(
ObjectUtils
.
isEmpty
(
user
)){
if
(
ObjectUtils
.
isEmpty
(
user
))
{
throw
new
RuntimeException
(
"没有该用户!"
);
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_id_or_pwd_error"
)
);
}
}
if
(
user
.
getEnabled
()
==
0
)
{
if
(
user
.
getEnabled
()
==
0
)
{
throw
new
RuntimeException
(
"用户已经失效!"
);
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_id_or_pwd_error"
)
);
}
}
String
realPwd
=
user
.
getPassword
();
String
realPwd
=
user
.
getPassword
();
//私钥解密
//私钥解密
...
@@ -53,10 +55,10 @@ public class AuthServer implements AuthApi {
...
@@ -53,10 +55,10 @@ public class AuthServer implements AuthApi {
//md5加密
//md5加密
pwd
=
CodingUtil
.
md5
(
pwd
);
pwd
=
CodingUtil
.
md5
(
pwd
);
if
(!
StringUtils
.
equals
(
pwd
,
realPwd
)){
if
(!
StringUtils
.
equals
(
pwd
,
realPwd
))
{
throw
new
RuntimeException
(
"密码错误!"
);
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_id_or_pwd_error"
)
);
}
}
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
TokenInfo
tokenInfo
=
TokenInfo
.
builder
().
userId
(
user
.
getUserId
()).
username
(
username
).
lastLoginTime
(
System
.
currentTimeMillis
()).
build
();
TokenInfo
tokenInfo
=
TokenInfo
.
builder
().
userId
(
user
.
getUserId
()).
username
(
username
).
lastLoginTime
(
System
.
currentTimeMillis
()).
build
();
String
token
=
JWTUtils
.
sign
(
tokenInfo
,
realPwd
);
String
token
=
JWTUtils
.
sign
(
tokenInfo
,
realPwd
);
// 记录token操作时间
// 记录token操作时间
...
@@ -68,7 +70,7 @@ public class AuthServer implements AuthApi {
...
@@ -68,7 +70,7 @@ public class AuthServer implements AuthApi {
@Override
@Override
public
CurrentUserDto
userInfo
()
{
public
CurrentUserDto
userInfo
()
{
CurrentUserDto
userDto
=
(
CurrentUserDto
)
SecurityUtils
.
getSubject
().
getPrincipal
();
CurrentUserDto
userDto
=
(
CurrentUserDto
)
SecurityUtils
.
getSubject
().
getPrincipal
();
if
(
ObjectUtils
.
isEmpty
(
userDto
))
{
if
(
ObjectUtils
.
isEmpty
(
userDto
))
{
String
token
=
ServletUtils
.
getToken
();
String
token
=
ServletUtils
.
getToken
();
Long
userId
=
JWTUtils
.
tokenInfoByToken
(
token
).
getUserId
();
Long
userId
=
JWTUtils
.
tokenInfoByToken
(
token
).
getUserId
();
...
@@ -84,7 +86,7 @@ public class AuthServer implements AuthApi {
...
@@ -84,7 +86,7 @@ public class AuthServer implements AuthApi {
}
}
@Override
@Override
public
String
logout
(){
public
String
logout
()
{
String
token
=
ServletUtils
.
getToken
();
String
token
=
ServletUtils
.
getToken
();
Long
userId
=
JWTUtils
.
tokenInfoByToken
(
token
).
getUserId
();
Long
userId
=
JWTUtils
.
tokenInfoByToken
(
token
).
getUserId
();
authUserService
.
clearCache
(
userId
);
authUserService
.
clearCache
(
userId
);
...
...
backend/src/main/java/io/dataease/controller/IndexController.java
浏览文件 @
c3e91577
...
@@ -14,7 +14,7 @@ public class IndexController {
...
@@ -14,7 +14,7 @@ public class IndexController {
return
"index.html"
;
return
"index.html"
;
}
}
@GetMapping
(
value
=
"/login"
)
@GetMapping
(
value
=
"/l
l
ogin"
)
public
String
login
()
{
public
String
login
()
{
return
"index.html"
;
return
"index.html"
;
}
}
...
...
backend/src/main/resources/i18n/messages_en_US.properties
浏览文件 @
c3e91577
...
@@ -247,3 +247,4 @@ i18n_datasource_check_fail=Invalid,please check config
...
@@ -247,3 +247,4 @@ i18n_datasource_check_fail=Invalid,please check config
i18n_not_find_user
=
Can not find user.
i18n_not_find_user
=
Can not find user.
i18n_sql_not_empty
=
SQL can not be empty.
i18n_sql_not_empty
=
SQL can not be empty.
i18n_task_name_repeat
=
Name is used in same data set
i18n_task_name_repeat
=
Name is used in same data set
i18n_id_or_pwd_error
=
Invalid ID or password
\ No newline at end of file
backend/src/main/resources/i18n/messages_zh_CN.properties
浏览文件 @
c3e91577
...
@@ -249,3 +249,4 @@ i18n_datasource_check_fail=校验失败,请检查配置信息
...
@@ -249,3 +249,4 @@ i18n_datasource_check_fail=校验失败,请检查配置信息
i18n_not_find_user
=
未找到用户
i18n_not_find_user
=
未找到用户
i18n_sql_not_empty
=
SQL 不能为空
i18n_sql_not_empty
=
SQL 不能为空
i18n_task_name_repeat
=
同一数据集下任务名称已被使用
i18n_task_name_repeat
=
同一数据集下任务名称已被使用
i18n_id_or_pwd_error
=
无效的ID或密码
\ No newline at end of file
backend/src/main/resources/i18n/messages_zh_TW.properties
浏览文件 @
c3e91577
...
@@ -249,3 +249,4 @@ i18n_datasource_check_fail=校驗失敗,請檢查配置信息
...
@@ -249,3 +249,4 @@ i18n_datasource_check_fail=校驗失敗,請檢查配置信息
i18n_not_find_user
=
未找到用戶
i18n_not_find_user
=
未找到用戶
i18n_sql_not_empty
=
SQL 不能為空
i18n_sql_not_empty
=
SQL 不能為空
i18n_task_name_repeat
=
同一數據集下任務名稱已被使用
i18n_task_name_repeat
=
同一數據集下任務名稱已被使用
i18n_id_or_pwd_error
=
無效的ID或密碼
\ No newline at end of file
frontend/src/lang/en.js
浏览文件 @
c3e91577
...
@@ -283,7 +283,9 @@ export default {
...
@@ -283,7 +283,9 @@ export default {
},
},
datasource
:
'Datasource'
,
datasource
:
'Datasource'
,
char_can_not_more_50
:
'Can not more 50 char'
,
char_can_not_more_50
:
'Can not more 50 char'
,
share_success
:
'Share Success'
share_success
:
'Share Success'
,
input_id
:
'Please input ID'
,
input_pwd
:
'Please input password'
},
},
documentation
:
{
documentation
:
{
documentation
:
'Documentation'
,
documentation
:
'Documentation'
,
...
...
frontend/src/lang/tw.js
浏览文件 @
c3e91577
...
@@ -283,7 +283,9 @@ export default {
...
@@ -283,7 +283,9 @@ export default {
},
},
datasource
:
'數據源'
,
datasource
:
'數據源'
,
char_can_not_more_50
:
'不能超過50字符'
,
char_can_not_more_50
:
'不能超過50字符'
,
share_success
:
'分享成功'
share_success
:
'分享成功'
,
input_id
:
'請輸入ID'
,
input_pwd
:
'請輸入密碼'
},
},
documentation
:
{
documentation
:
{
documentation
:
'文檔'
,
documentation
:
'文檔'
,
...
...
frontend/src/lang/zh.js
浏览文件 @
c3e91577
...
@@ -283,7 +283,9 @@ export default {
...
@@ -283,7 +283,9 @@ export default {
},
},
datasource
:
'数据源'
,
datasource
:
'数据源'
,
char_can_not_more_50
:
'不能超过50字符'
,
char_can_not_more_50
:
'不能超过50字符'
,
share_success
:
'分享成功'
share_success
:
'分享成功'
,
input_id
:
'请输入ID'
,
input_pwd
:
'请输入密码'
},
},
documentation
:
{
documentation
:
{
documentation
:
'文档'
,
documentation
:
'文档'
,
...
...
frontend/src/views/login/index.vue
浏览文件 @
c3e91577
...
@@ -84,8 +84,8 @@ export default {
...
@@ -84,8 +84,8 @@ export default {
password
:
''
password
:
''
},
},
loginRules
:
{
loginRules
:
{
username
:
[{
required
:
true
,
trigger
:
'blur'
,
validator
:
validateUsername
}],
username
:
[{
required
:
true
,
trigger
:
'blur'
,
message
:
this
.
$t
(
'commons.input_id'
)
}],
password
:
[{
required
:
true
,
trigger
:
'blur'
,
validator
:
validatePassword
}]
password
:
[{
required
:
true
,
trigger
:
'blur'
,
message
:
this
.
$t
(
'commons.input_pwd'
)
}]
},
},
loading
:
false
,
loading
:
false
,
passwordType
:
'password'
,
passwordType
:
'password'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论