Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sass-admin
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj_app
sass-admin
Commits
c7fbcb68
Commit
c7fbcb68
authored
Jun 13, 2025
by
end
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加重置密码
parent
4d43a812
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
17 deletions
+88
-17
dist.zip
+0
-0
src/pages/SystemManagement/Organization/EditPassword/EditPassword.jsx
+1
-15
src/pages/SystemManagement/Organization/UserTable/UserTable.jsx
+80
-0
src/pages/SystemManagement/Organization/redux/action.js
+7
-2
No files found.
dist.zip
View file @
c7fbcb68
No preview for this file type
src/pages/SystemManagement/Organization/EditPassword/EditPassword.jsx
View file @
c7fbcb68
...
...
@@ -67,20 +67,12 @@ class EditPassword extends Component {
const
public_key
=
'047214fe3a249b75b6ba92ee494e0a8a68c0a19893a480b3c28bf06cd5b7d621243c7f6704caa3b43ade6be15de11cabd185611a9edfdcf1b11d7a2478c67b4c1c'
;
const
private_key
=
'00a2bbe941a177ca9f200d1c4d37e8f0b43b9cd2ea662304a05c064c6416e74d49'
;
const
salt
=
this
.
generateCharacter
(
16
);
console
.
log
(
"validate-salt"
,
salt
);
const
date
=
this
.
getCurrentDay
();
console
.
log
(
"validate-date"
,
date
);
const
newPassword
=
"04"
+
sm2
.
doEncrypt
(
password
+
salt
,
public_key
,
1
);
const
requestId
=
"04"
+
sm2
.
doEncrypt
(
id
+
salt
,
public_key
,
1
);
const
key
=
salt
+
date
;
console
.
log
(
"validate-key"
,
key
);
const
sign
=
`id=
${
requestId
}
&password=
${
newPassword
}
&salt=
${
salt
}
&key=
${
key
}
`
;
console
.
log
(
"validate-sign"
,
md5
(
sign
));
const
parms
=
{
id
:
requestId
,
...
...
@@ -88,13 +80,7 @@ class EditPassword extends Component {
salt
:
salt
,
sign
:
md5
(
sign
)
};
if
(
typeof
this
.
props
.
accountUpdatePassword
!==
'function'
)
{
console
.
error
(
'accountUpdatePassword 不是一个函数'
);
return
;
}
await
this
.
props
.
accountUpdatePassword
(
parms
);
await
this
.
props
.
accountUpdatePassword
(
parms
,
"edit"
);
// 关闭模态框
if
(
typeof
this
.
props
.
onCancel
===
'function'
)
{
this
.
props
.
onCancel
(
false
);
...
...
src/pages/SystemManagement/Organization/UserTable/UserTable.jsx
View file @
c7fbcb68
...
...
@@ -5,6 +5,8 @@ import StopUser from "../StopUser/StopUser";
import
EditUser
from
"../EditUser/EditUser"
;
import
EditPasswords
from
"../EditPassword/EditPassword"
;
import
moment
from
"moment"
;
import
{
sm2
}
from
"sm-crypto"
;
import
md5
from
"md5"
;
class
UserTable
extends
Component
{
constructor
(
props
)
{
...
...
@@ -93,6 +95,8 @@ class UserTable extends Component {
<
a
onClick=
{
()
=>
this
.
handleEditPassWord
(
"修改密码"
,
record
)
}
>
修改密码
</
a
>
<
Divider
type=
"vertical"
/>
<
a
onClick=
{
()
=>
this
.
handleResetPassword
(
record
)
}
>
重置密码
</
a
>
</
span
>
);
},
...
...
@@ -201,6 +205,82 @@ class UserTable extends Component {
this
.
props
.
accountUpdatePassword
(
values
);
});
};
generateCharacter
(
n
)
{
var
chars
=
[
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
,
"T"
,
"U"
,
"V"
,
"W"
,
"X"
,
"Y"
,
"Z"
,
];
var
res
=
""
;
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
var
id
=
Math
.
ceil
(
Math
.
random
()
*
35
);
res
+=
chars
[
id
];
}
return
res
;
}
getCurrentDay
()
{
let
date
=
""
;
date
=
moment
(
new
Date
()).
format
(
"YYYYMMDD"
);
return
date
;
}
handleResetPassword
=
async
(
record
)
=>
{
try
{
const
id
=
record
.
id
;
const
password
=
"Exf@6666"
;
const
public_key
=
"047214fe3a249b75b6ba92ee494e0a8a68c0a19893a480b3c28bf06cd5b7d621243c7f6704caa3b43ade6be15de11cabd185611a9edfdcf1b11d7a2478c67b4c1c"
;
const
salt
=
this
.
generateCharacter
(
16
);
const
date
=
this
.
getCurrentDay
();
const
newPassword
=
"04"
+
sm2
.
doEncrypt
(
password
+
salt
,
public_key
,
1
);
const
requestId
=
"04"
+
sm2
.
doEncrypt
(
id
+
salt
,
public_key
,
1
);
const
key
=
salt
+
date
;
const
sign
=
`id=
${
requestId
}
&password=
${
newPassword
}
&salt=
${
salt
}
&key=
${
key
}
`
;
const
parms
=
{
id
:
requestId
,
password
:
newPassword
,
salt
:
salt
,
sign
:
md5
(
sign
),
};
await
this
.
props
.
accountUpdatePassword
(
parms
,
"reset"
);
}
catch
(
error
)
{
console
.
error
(
"重置密码时发生错误:"
,
error
);
}
};
render
()
{
//dataSource rowKey 报警高 给后台说加可以
// console.log(this.props.records);
...
...
src/pages/SystemManagement/Organization/redux/action.js
View file @
c7fbcb68
...
...
@@ -313,7 +313,7 @@ let actions = {
};
},
//修改用户密码
accountUpdatePassword
(
data
)
{
accountUpdatePassword
(
data
,
type
)
{
return
dispatch
=>
{
// accountUpdatePassword(data)
return
request
({
...
...
@@ -322,7 +322,12 @@ let actions = {
})
.
then
(
res
=>
{
if
(
res
.
code
==
1000
)
{
return
message
.
success
(
"密码修改成功"
);
if
(
type
==
"edit"
){
return
message
.
success
(
"密码修改成功"
);
}
if
(
type
==
"reset"
){
return
message
.
success
(
"密码重置成功"
);
}
}
// if (!(res.code == 1000)) {
// message.info(res.subMsg);
...
...
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