Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
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
ReactWeb5
CivManage
Commits
8136c1ce
Commit
8136c1ce
authored
Jul 24, 2023
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '用户密码自定义验证规则'
parent
306bad43
Pipeline
#76531
passed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
11 deletions
+37
-11
AddUserModal.jsx
src/pages/userCenter/userManage/AddUserModal.jsx
+17
-3
EditUserModal.jsx
src/pages/userCenter/userManage/EditUserModal.jsx
+15
-7
api.js
src/services/userManage/api.js
+5
-1
No files found.
src/pages/userCenter/userManage/AddUserModal.jsx
View file @
8136c1ce
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Modal
,
Form
,
Input
,
notification
,
message
,
TreeSelect
,
Select
}
from
'antd'
;
import
{
addUser
,
GetUserRelationListNew
}
from
'@/services/userManage/api'
;
import
{
addUser
,
GetUserRelationListNew
,
GetPasswordRegularization
,
}
from
'@/services/userManage/api'
;
import
classNames
from
'classnames'
;
import
sha1
from
'sha1'
;
import
{
ok
}
from
'../../../assets/images/icons/ok.svg'
;
...
...
@@ -19,6 +23,7 @@ const AddUserModal = props => {
const
[
value
,
setValue
]
=
useState
([
'0-1-1'
]);
const
[
treeData
,
setTreeData
]
=
useState
([]);
const
[
passwordLevel
,
setPasswordLevel
]
=
useState
(
''
);
// 密码等级
const
[
rules
,
setRules
]
=
useState
();
const
onChange
=
newValue
=>
{
console
.
log
(
'onChange '
,
value
);
setValue
(
newValue
);
...
...
@@ -26,6 +31,7 @@ const AddUserModal = props => {
useEffect
(()
=>
{
if
(
visible
)
{
getPasswordRule
();
addUserForm
.
resetFields
();
getEmptyRoleList
();
}
else
{
...
...
@@ -33,6 +39,14 @@ const AddUserModal = props => {
}
},
[
orgID
,
visible
]);
const
getPasswordRule
=
()
=>
{
GetPasswordRegularization
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setRules
(
res
.
data
);
}
});
};
// 获取全部未勾选站点列表
const
getEmptyRoleList
=
()
=>
{
GetUserRelationListNew
({
userID
:
0
})
...
...
@@ -262,8 +276,8 @@ const AddUserModal = props => {
label=
"账号密码"
rules=
{
[
{
pattern
:
/^
(?=
.*
[
a-zA-Z
])(?=
.*
\d)[\w\S]
{6,16}$/
,
message
:
'长度6-16位,必须包含数字与字母'
,
pattern
:
rules
?
rules
.
regex
:
`/^(?=.*[a-zA-Z])(?=.*d)[wS]{6,16}$/`
,
message
:
rules
?
rules
.
tip
:
'长度6-16位,必须包含数字与字母'
,
},
{
pattern
:
/^
(?!
.*
(?:
SELECT|UPDATE|INSERT|AND|OR|'|"|;|--|
\\))
.*$/
,
...
...
src/pages/userCenter/userManage/EditUserModal.jsx
View file @
8136c1ce
...
...
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
import
{
Modal
,
Form
,
Input
,
notification
,
message
,
Divider
}
from
'antd'
;
import
voca
from
'voca'
;
import
classNames
from
'classnames'
;
import
{
editUser
,
updateUserPassword
}
from
'@/services/userManage/api'
;
import
{
editUser
,
updateUserPassword
,
GetPasswordRegularization
}
from
'@/services/userManage/api'
;
import
sha1
from
'sha1'
;
import
styles
from
'./AddUserModal.less'
;
...
...
@@ -19,17 +19,17 @@ const EditUserModal = props => {
const
[
passwordForm
]
=
Form
.
useForm
();
// 修改密码
const
[
newPasswordLevel
,
setNewPasswordLevel
]
=
useState
(
''
);
const
[
passwordConfirmLevel
,
setPasswordConfirmLevel
]
=
useState
(
''
);
const
[
rules
,
setRules
]
=
useState
();
useEffect
(()
=>
{
if
(
visible
)
{
console
.
log
(
currentUser
);
getPasswordRule
(
);
editUserForm
.
setFieldsValue
({
loginName
:
voca
.
stripTags
(
currentUser
.
loginName
),
userName
:
voca
.
stripTags
(
currentUser
.
userName
),
phone
:
voca
.
stripTags
(
currentUser
.
phone
)
||
''
,
email
:
currentUser
.
email
||
''
,
});
console
.
log
(
currentUser
.
password
);
passwordForm
.
setFieldsValue
({
oldPassword
:
currentUser
.
password
,
newPassword
:
''
,
...
...
@@ -41,6 +41,14 @@ const EditUserModal = props => {
}
},
[
visible
]);
const
getPasswordRule
=
()
=>
{
GetPasswordRegularization
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setRules
(
res
.
data
);
}
});
};
// 提交-编辑用户
const
submitEditUser
=
()
=>
{
const
loginName
=
voca
.
stripTags
(
editUserForm
.
getFieldValue
(
'loginName'
));
...
...
@@ -359,8 +367,8 @@ const EditUserModal = props => {
label=
"新密码"
rules=
{
[
{
pattern
:
/^
(?=
.*
[
a-zA-Z
])(?=
.*
\d)[\w\S]
{6,16}$/
,
message
:
'长度6-16位,必须包含数字与字母'
,
pattern
:
rules
?
rules
.
regex
:
`/^(?=.*[a-zA-Z])(?=.*d)[wS]{6,16}$/`
,
message
:
rules
?
rules
.
tip
:
'长度6-16位,必须包含数字与字母'
,
},
{
pattern
:
/^
(?!
.*
(?:
SELECT|UPDATE|INSERT|AND|OR|'|"|;|--|
\\))
.*$/
,
...
...
@@ -398,8 +406,8 @@ const EditUserModal = props => {
label=
"确认密码"
rules=
{
[
{
pattern
:
/^
(?=
.*
[
a-zA-Z
])(?=
.*
\d)[\w\S]
{6,16}$/
,
message
:
'长度6-16位,必须包含数字与字母'
,
pattern
:
rules
?
rules
.
regex
:
`/^(?=.*[a-zA-Z])(?=.*d)[wS]{6,16}$/`
,
message
:
rules
?
rules
.
tip
:
'长度6-16位,必须包含数字与字母'
,
},
{
pattern
:
/^
(?!
.*
(?:
SELECT|UPDATE|INSERT|AND|OR|'|"|;|--|
\\))
.*$/
,
...
...
src/services/userManage/api.js
View file @
8136c1ce
...
...
@@ -186,9 +186,13 @@ export const DragGroup = params => post(`${PUBLISH_SERVICE}/UserCenter/DragGroup
// 获取所有站点
export
const
GetAllSite
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/GetAllSite`
,
params
);
// 设置为主管
export
const
SetGroupManager
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/SetGroupManager`
,
params
);
export
const
SetGroupManager
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/SetGroupManager`
,
params
);
// 设置接收短信
export
const
ChangeSMSState
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/ChangeSMSState`
,
params
);
// 获取用户密码验证规则
export
const
GetPasswordRegularization
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/GetPasswordRegularization`
,
params
);
// export const DeleteOUNew = params =>
// get(`${PUBLISH_SERVICE}/UserCenter/DeleteOU`, params)
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