Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
7fb42113
Commit
7fb42113
authored
Sep 04, 2023
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户修改密码加解密
parent
9ad8b2b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
portal-manager/src/main/java/com/mortals/xhx/module/user/web/UserController.java
.../java/com/mortals/xhx/module/user/web/UserController.java
+18
-0
No files found.
portal-manager/src/main/java/com/mortals/xhx/module/user/web/UserController.java
View file @
7fb42113
...
...
@@ -9,6 +9,7 @@ import com.mortals.framework.model.PageInfo;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.common.utils.LoginAESUtil
;
import
com.mortals.xhx.module.param.service.ParamService
;
import
com.mortals.xhx.module.role.model.RoleEntity
;
import
com.mortals.xhx.module.role.model.RoleQuery
;
...
...
@@ -54,6 +55,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
@Autowired
private
ICacheService
cacheService
;
private
static
final
String
AES_KEY
=
"0000000671595991"
;
private
static
final
String
AES_IV
=
"tdrdadq59tbss5n7"
;
public
UserController
()
{
super
.
setModuleDesc
(
"用户信息业务"
);
}
...
...
@@ -80,6 +84,14 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
return
super
.
viewAfter
(
id
,
model
,
entity
,
context
);
}
@Override
protected
void
saveBefore
(
UserEntity
entity
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
String
loginName
=
LoginAESUtil
.
decrypt
(
entity
.
getLoginName
(),
AES_KEY
,
AES_IV
,
LoginAESUtil
.
AES_CBC
);
String
loginPwd
=
LoginAESUtil
.
decrypt
(
entity
.
getLoginPwd
(),
AES_KEY
,
AES_IV
,
LoginAESUtil
.
AES_CBC
);
entity
.
setLoginName
(
loginName
);
entity
.
setLoginPwd
(
loginPwd
);
}
@Override
@UnAuth
public
Rest
<
Object
>
list
(
@RequestBody
UserEntity
query
)
{
...
...
@@ -145,6 +157,10 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
public
String
changePassword
(
@RequestBody
UserEntity
entity
)
{
JSONObject
ret
=
new
JSONObject
();
try
{
String
oldPwd
=
LoginAESUtil
.
decrypt
(
entity
.
getOldPwd
(),
AES_KEY
,
AES_IV
,
LoginAESUtil
.
AES_CBC
);
String
newPwd
=
LoginAESUtil
.
decrypt
(
entity
.
getNewPwd
(),
AES_KEY
,
AES_IV
,
LoginAESUtil
.
AES_CBC
);
entity
.
setOldPwd
(
oldPwd
);
entity
.
setNewPwd
(
newPwd
);
service
.
updateUserPwd
(
super
.
getCurUser
().
getLoginName
(),
entity
.
getOldPwd
(),
entity
.
getNewPwd
());
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"密码修改成功!"
);
...
...
@@ -250,6 +266,8 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
public
String
resetPassword
(
@RequestBody
UserEntity
entity
)
{
JSONObject
ret
=
new
JSONObject
();
try
{
String
newPwd
=
LoginAESUtil
.
decrypt
(
entity
.
getNewPwd
(),
AES_KEY
,
AES_IV
,
LoginAESUtil
.
AES_CBC
);
entity
.
setNewPwd
(
newPwd
);
service
.
resetUserPwd
(
entity
.
getLoginName
(),
entity
.
getNewPwd
(),
this
.
getContext
());
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"密码修改成功!"
);
...
...
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