Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
Overview
Overview
Details
Activity
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
base_platform_enterprise
gic-platform-auth
Commits
230fcb07
Commit
230fcb07
authored
Sep 06, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增/编辑管理员添加标志位,用来操作密码
parent
d3e69864
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
UserController.java
...main/java/com/gic/auth/web/controller/UserController.java
+1
-1
UserPasswordUtils.java
...c/main/java/com/gic/auth/web/utils/UserPasswordUtils.java
+11
-5
No files found.
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/UserController.java
View file @
230fcb07
...
...
@@ -30,7 +30,7 @@ public class UserController {
@RequestMapping
(
"/save-or-update-user"
)
public
RestResponse
editUser
(
@Validated
({
UserDTO
.
UserQoValid
.
class
})
UserDTO
userDTO
)
{
userDTO
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
String
password
=
UserPasswordUtils
.
validPassword
(
userDTO
.
getPasswordType
(),
userDTO
.
getPassword
());
String
password
=
UserPasswordUtils
.
validPassword
(
userDTO
.
getPasswordType
(),
userDTO
.
getPassword
()
,
userDTO
.
getOperPasswordType
()
);
userDTO
.
setPassword
(
UserPasswordUtils
.
getEncryptPassword
(
password
));
ServiceResponse
userResult
;
//普通用户
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/utils/UserPasswordUtils.java
View file @
230fcb07
...
...
@@ -45,16 +45,22 @@ public class UserPasswordUtils {
* @param password
* @return
*/
public
static
String
validPassword
(
int
passwordType
,
String
password
)
{
public
static
String
validPassword
(
int
passwordType
,
String
password
,
Integer
operPasswordType
)
{
//加密
if
(
UserConstants
.
CREATE_AUTO
==
passwordType
)
{
//自动随机生成
return
createPasswordAuto
(
8
);
}
else
{
if
(
StringUtils
.
isNotBlank
(
password
))
{
return
password
;
}
else
{
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"密码不能为空"
);
if
(
operPasswordType
==
null
)
{
operPasswordType
=
2
;
}
if
(
operPasswordType
.
intValue
()
!=
1
)
{
//如果不等于1,则需要验证密码
if
(
StringUtils
.
isNotBlank
(
password
))
{
return
password
;
}
else
{
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"密码不能为空"
);
}
}
}
}
...
...
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