Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengtianlai3
ioc_sixiang_license
Commits
3d53b9e4
Commit
3d53b9e4
authored
Jun 15, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
校验用户名,由字母、数字或下划线组成。修复post请求的token鉴权失败重定向bug。
parent
5e54a651
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
LoginController.java
.../java/iot/sixiang/license/controller/LoginController.java
+5
-7
UserServiceImpl.java
...ava/iot/sixiang/license/service/impl/UserServiceImpl.java
+3
-2
CommonUtil.java
...se/src/main/java/iot/sixiang/license/util/CommonUtil.java
+6
-0
No files found.
license/src/main/java/iot/sixiang/license/controller/LoginController.java
View file @
3d53b9e4
...
@@ -12,13 +12,9 @@ import iot.sixiang.license.model.BaseResult;
...
@@ -12,13 +12,9 @@ import iot.sixiang.license.model.BaseResult;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.model.vo.LoginVo
;
import
iot.sixiang.license.model.vo.LoginVo
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -70,9 +66,11 @@ public class LoginController {
...
@@ -70,9 +66,11 @@ public class LoginController {
return
BaseResult
.
success
();
return
BaseResult
.
success
();
}
}
@
GetMapping
(
"fail"
)
@
RequestMapping
(
value
=
"fail"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
}
)
@ApiIgnore
@ApiIgnore
public
BaseResult
fail
(
HttpServletRequest
request
)
{
public
BaseResult
fail
()
{
return
BaseResult
.
unauthorized
();
return
BaseResult
.
unauthorized
();
}
}
}
}
license/src/main/java/iot/sixiang/license/service/impl/UserServiceImpl.java
View file @
3d53b9e4
...
@@ -9,6 +9,7 @@ import iot.sixiang.license.mapper.UserMapper;
...
@@ -9,6 +9,7 @@ import iot.sixiang.license.mapper.UserMapper;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.vo.UserVo
;
import
iot.sixiang.license.model.vo.UserVo
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.util.CommonUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -60,8 +61,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
...
@@ -60,8 +61,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
@Override
@Override
public
boolean
addUser
(
String
userName
,
String
company
,
String
password
)
{
public
boolean
addUser
(
String
userName
,
String
company
,
String
password
)
{
if
(
StringUtils
.
isEmpty
(
userName
)
||
StringUtils
.
isEmpty
(
company
))
{
if
(
StringUtils
.
isEmpty
(
userName
)
||
StringUtils
.
isEmpty
(
company
)
||
!
CommonUtil
.
regularMessage
(
userName
))
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
}
User
res
=
userMapper
.
getUserByUserName
(
userName
);
User
res
=
userMapper
.
getUserByUserName
(
userName
);
if
(
res
!=
null
)
{
if
(
res
!=
null
)
{
...
...
license/src/main/java/iot/sixiang/license/util/CommonUtil.java
View file @
3d53b9e4
...
@@ -233,4 +233,10 @@ public class CommonUtil {
...
@@ -233,4 +233,10 @@ public class CommonUtil {
return
result
;
return
result
;
}
}
public
static
boolean
regularMessage
(
String
message
)
{
String
regex
=
"^[a-z0-9A-Z]+$"
;
regex
=
"^[0-9a-zA-Z_]{1,}$"
;
return
message
.
matches
(
regex
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment