Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
89370df9
提交
89370df9
authored
4月 22, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 登录页面增加用户名验证
上级
acf8ecbd
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
38 行增加
和
4 行删除
+38
-4
AuthApi.java
backend/src/main/java/io/dataease/auth/api/AuthApi.java
+5
-0
AuthServer.java
...end/src/main/java/io/dataease/auth/server/AuthServer.java
+9
-0
ShiroServiceImpl.java
.../java/io/dataease/auth/service/impl/ShiroServiceImpl.java
+1
-0
user.js
frontend/src/api/user.js
+8
-0
index.vue
frontend/src/views/login/index.vue
+15
-4
没有找到文件。
backend/src/main/java/io/dataease/auth/api/AuthApi.java
浏览文件 @
89370df9
...
@@ -7,6 +7,8 @@ import org.springframework.web.bind.annotation.GetMapping;
...
@@ -7,6 +7,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
java.util.Map
;
@Api
(
tags
=
"权限:权限管理"
)
@Api
(
tags
=
"权限:权限管理"
)
@RequestMapping
(
"/api/auth"
)
@RequestMapping
(
"/api/auth"
)
...
@@ -26,6 +28,9 @@ public interface AuthApi {
...
@@ -26,6 +28,9 @@ public interface AuthApi {
@PostMapping
(
"/logout"
)
@PostMapping
(
"/logout"
)
String
logout
();
String
logout
();
@PostMapping
(
"/validateName"
)
Boolean
validateName
(
Map
<
String
,
String
>
nameDto
);
@GetMapping
(
"/test"
)
@GetMapping
(
"/test"
)
String
test
();
String
test
();
...
...
backend/src/main/java/io/dataease/auth/server/AuthServer.java
浏览文件 @
89370df9
...
@@ -82,6 +82,15 @@ public class AuthServer implements AuthApi {
...
@@ -82,6 +82,15 @@ public class AuthServer implements AuthApi {
return
"success"
;
return
"success"
;
}
}
@Override
public
Boolean
validateName
(
@RequestBody
Map
<
String
,
String
>
nameDto
)
{
String
userName
=
nameDto
.
get
(
"userName"
);
if
(
StringUtils
.
isEmpty
(
userName
))
return
false
;
SysUserEntity
userEntity
=
authUserService
.
getUserByName
(
userName
);
if
(
ObjectUtils
.
isEmpty
(
userEntity
))
return
false
;
return
true
;
}
@Override
@Override
public
Boolean
isLogin
()
{
public
Boolean
isLogin
()
{
return
null
;
return
null
;
...
...
backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java
浏览文件 @
89370df9
...
@@ -49,6 +49,7 @@ public class ShiroServiceImpl implements ShiroService {
...
@@ -49,6 +49,7 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap
.
put
(
"/api/auth/login"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/api/auth/login"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/api/auth/validateName"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/unauth"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/unauth"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/display/**"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/display/**"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/tokenExpired"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/tokenExpired"
,
ANON
);
...
...
frontend/src/api/user.js
浏览文件 @
89370df9
...
@@ -21,3 +21,11 @@ export function logout() {
...
@@ -21,3 +21,11 @@ export function logout() {
method
:
'post'
method
:
'post'
})
})
}
}
export
function
validateUserName
(
data
)
{
return
request
({
url
:
'/api/auth/validateName'
,
method
:
'post'
,
data
})
}
frontend/src/views/login/index.vue
浏览文件 @
89370df9
...
@@ -49,17 +49,28 @@
...
@@ -49,17 +49,28 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
validUsername
}
from
'@/utils/validate'
import
{
encrypt
}
from
'@/utils/rsaEncrypt'
import
{
encrypt
}
from
'@/utils/rsaEncrypt'
import
{
validateUserName
}
from
'@/api/user'
export
default
{
export
default
{
name
:
'Login'
,
name
:
'Login'
,
data
()
{
data
()
{
const
validateUsername
=
(
rule
,
value
,
callback
)
=>
{
const
validateUsername
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
validUsername
(
value
))
{
const
userName
=
value
.
trim
()
callback
(
new
Error
(
'Please enter the correct user name'
))
validateUserName
({
userName
:
userName
}).
then
(
res
=>
{
}
else
{
if
(
res
.
data
)
{
callback
()
callback
()
}
else
{
callback
(
new
Error
(
'Please enter the correct user name'
))
}
}
}).
catch
(()
=>
{
callback
(
new
Error
(
'Please enter the correct user name'
))
})
// if (!validUsername(value)) {
// callback(new Error('Please enter the correct user name'))
// } else {
// callback()
// }
}
}
const
validatePassword
=
(
rule
,
value
,
callback
)
=>
{
const
validatePassword
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
.
length
<
6
)
{
if
(
value
.
length
<
6
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论