Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
4d9cbfe0
Commit
4d9cbfe0
authored
May 18, 2019
by
zhengjie
Browse files
v1.9 发布,详情查看发行版说明
parent
343ce346
Changes
1
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
View file @
4d9cbfe0
...
...
@@ -131,15 +131,15 @@ public class UserController {
/**
* 验证密码
* @param
pass
* @param
user
* @return
*/
@
Ge
tMapping
(
value
=
"/users/validPass
/{pass}
"
)
public
ResponseEntity
validPass
(
@
PathVariable
String
pass
){
@
Pos
tMapping
(
value
=
"/users/validPass"
)
public
ResponseEntity
validPass
(
@
RequestBody
User
user
){
UserDetails
userDetails
=
SecurityUtils
.
getUserDetails
();
Map
map
=
new
HashMap
();
map
.
put
(
"status"
,
200
);
if
(!
userDetails
.
getPassword
().
equals
(
EncryptUtils
.
encryptPassword
(
pass
))){
if
(!
userDetails
.
getPassword
().
equals
(
EncryptUtils
.
encryptPassword
(
user
.
getPassword
()
))){
map
.
put
(
"status"
,
400
);
}
return
new
ResponseEntity
(
map
,
HttpStatus
.
OK
);
...
...
@@ -147,16 +147,16 @@ public class UserController {
/**
* 修改密码
* @param
pass
* @param
user
* @return
*/
@
Ge
tMapping
(
value
=
"/users/updatePass
/{pass}
"
)
public
ResponseEntity
updatePass
(
@
PathVariable
String
pass
){
@
Pos
tMapping
(
value
=
"/users/updatePass"
)
public
ResponseEntity
updatePass
(
@
RequestBody
User
user
){
UserDetails
userDetails
=
SecurityUtils
.
getUserDetails
();
if
(
userDetails
.
getPassword
().
equals
(
EncryptUtils
.
encryptPassword
(
pass
))){
if
(
userDetails
.
getPassword
().
equals
(
EncryptUtils
.
encryptPassword
(
user
.
getPassword
()
))){
throw
new
BadRequestException
(
"新密码不能与旧密码相同"
);
}
userService
.
updatePass
(
userDetails
.
getUsername
(),
EncryptUtils
.
encryptPassword
(
pass
));
userService
.
updatePass
(
userDetails
.
getUsername
(),
EncryptUtils
.
encryptPassword
(
user
.
getPassword
()
));
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
...
...
Write
Preview
Supports
Markdown
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