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
1152a441
Commit
1152a441
authored
Sep 23, 2022
by
邓超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 机构管理密码强度规则修改
parent
9972a808
Pipeline
#60941
passed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
74 deletions
+127
-74
AddUserModal.jsx
src/pages/userCenter/userManage/AddUserModal.jsx
+36
-25
AddUserModal.less
src/pages/userCenter/userManage/AddUserModal.less
+25
-0
ChangePasswordModal.jsx
src/pages/userCenter/userManage/ChangePasswordModal.jsx
+66
-49
No files found.
src/pages/userCenter/userManage/AddUserModal.jsx
View file @
1152a441
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Modal
,
Form
,
Input
,
notification
,
message
,
TreeSelect
}
from
'antd'
;
import
{
Modal
,
Form
,
Input
,
notification
,
message
,
TreeSelect
}
from
'antd'
;
import
{
addUser
,
GetUserRelationListNew
}
from
'@/services/userManage/api'
;
import
{
addUser
,
GetUserRelationListNew
}
from
'@/services/userManage/api'
;
import
classNames
from
'classnames'
;
import
{
ok
}
from
'../../../assets/images/icons/ok.svg'
;
import
{
ok
}
from
'../../../assets/images/icons/ok.svg'
;
import
styles
from
'./AddUserModal.less'
;
import
styles
from
'./AddUserModal.less'
;
const
{
SHOW_CHILD
}
=
TreeSelect
;
const
{
SHOW_CHILD
}
=
TreeSelect
;
...
@@ -16,7 +17,7 @@ const AddUserModal = props => {
...
@@ -16,7 +17,7 @@ const AddUserModal = props => {
);
// 邮箱
);
// 邮箱
const
[
value
,
setValue
]
=
useState
([
'0-1-1'
]);
const
[
value
,
setValue
]
=
useState
([
'0-1-1'
]);
const
[
treeData
,
setTreeData
]
=
useState
([]);
const
[
treeData
,
setTreeData
]
=
useState
([]);
const
[
passwordLevel
,
setPasswordLevel
]
=
useState
(
'
弱
'
);
// 密码等级
const
[
passwordLevel
,
setPasswordLevel
]
=
useState
(
''
);
// 密码等级
const
onChange
=
newValue
=>
{
const
onChange
=
newValue
=>
{
console
.
log
(
'onChange '
,
value
);
console
.
log
(
'onChange '
,
value
);
setValue
(
newValue
);
setValue
(
newValue
);
...
@@ -163,25 +164,23 @@ const AddUserModal = props => {
...
@@ -163,25 +164,23 @@ const AddUserModal = props => {
switch
(
modes
)
{
switch
(
modes
)
{
case
1
:
case
1
:
setPasswordLevel
(
'弱'
);
setPasswordLevel
(
'弱'
);
// return 1;
break
;
break
;
case
2
:
case
2
:
setPasswordLevel
(
'弱'
);
break
;
case
3
:
if
(
sValue
.
length
>
8
)
{
if
(
sValue
.
length
>
8
)
{
setPasswordLevel
(
'中'
);
setPasswordLevel
(
'中'
);
}
else
{
}
else
{
setPasswordLevel
(
'弱'
);
setPasswordLevel
(
'弱'
);
}
}
break
;
break
;
case
4
:
case
3
:
if
(
sValue
.
length
<
10
)
{
if
(
sValue
.
length
>
8
)
{
setPasswordLevel
(
'中'
);
}
else
{
setPasswordLevel
(
'强'
);
setPasswordLevel
(
'强'
);
}
else
{
setPasswordLevel
(
'中'
);
}
}
break
;
case
4
:
setPasswordLevel
(
'强'
);
break
;
break
;
}
}
};
};
...
@@ -213,7 +212,7 @@ const AddUserModal = props => {
...
@@ -213,7 +212,7 @@ const AddUserModal = props => {
destroyOnClose
destroyOnClose
afterClose=
{
()
=>
{
afterClose=
{
()
=>
{
addUserForm
.
resetFields
();
addUserForm
.
resetFields
();
setPasswordLevel
(
'
弱
'
);
setPasswordLevel
(
''
);
}
}
}
}
onOk=
{
submitAddUser
}
onOk=
{
submitAddUser
}
okText=
"确认"
okText=
"确认"
...
@@ -235,20 +234,32 @@ const AddUserModal = props => {
...
@@ -235,20 +234,32 @@ const AddUserModal = props => {
>
>
<
Input
placeholder=
"请输入登录名称(小于16位)"
maxLength=
"16"
/>
<
Input
placeholder=
"请输入登录名称(小于16位)"
maxLength=
"16"
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
div
className=
{
styles
.
formBox
}
>
hasFeedback
<
Form
.
Item
name=
"password"
hasFeedback
label=
"账号密码"
name=
"password"
rules=
{
[
label=
"账号密码"
{
rules=
{
[
pattern
:
/^
[
a-zA-Z0-9_
]
{6,16}$/
,
{
message
:
'长度6-16位,支持字母与数字,允许下划线'
,
pattern
:
/^
[
a-zA-Z0-9_
]
{6,16}$/
,
},
message
:
'长度6-16位,支持字母与数字,允许下划线'
,
{
required
:
true
},
},
]
}
{
required
:
true
},
>
]
}
<
Input
placeholder=
"请输入账号密码(6~16位)"
maxlength=
"16"
suffix=
{
passwordLevel
}
/>
>
</
Form
.
Item
>
<
Input
placeholder=
"请输入账号密码(6~16位)"
maxlength=
"16"
/>
</
Form
.
Item
>
<
div
className=
{
classNames
(
styles
.
tipsText
,
{
[
styles
.
tipsRed
]:
passwordLevel
===
'弱'
,
[
styles
.
tipsOrange
]:
passwordLevel
===
'中'
,
[
styles
.
tipsGreen
]:
passwordLevel
===
'强'
,
})
}
>
{
passwordLevel
}
</
div
>
</
div
>
<
Form
.
Item
<
Form
.
Item
hasFeedback
hasFeedback
name=
"userName"
name=
"userName"
...
...
src/pages/userCenter/userManage/AddUserModal.less
View file @
1152a441
...
@@ -5,4 +5,28 @@
...
@@ -5,4 +5,28 @@
.ant-form-item-feedback-icon {
.ant-form-item-feedback-icon {
margin-left: 10px;
margin-left: 10px;
}
}
.formBox {
position: relative;
.tipsText {
position: absolute;
right: 40px;
top: 5px;
z-index: 11;
}
.tipsGreen {
color: limegreen;
}
.tipsRed {
color: red;
}
.tipsOrange {
color: coral;
}
}
}
}
\ No newline at end of file
src/pages/userCenter/userManage/ChangePasswordModal.jsx
View file @
1152a441
...
@@ -2,12 +2,14 @@
...
@@ -2,12 +2,14 @@
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Modal
,
Form
,
Input
,
notification
,
message
}
from
'antd'
;
import
{
Modal
,
Form
,
Input
,
notification
,
message
}
from
'antd'
;
import
{
updateUserPassword
}
from
'@/services/userManage/api'
;
import
{
updateUserPassword
}
from
'@/services/userManage/api'
;
import
classNames
from
'classnames'
;
import
styles
from
'./AddUserModal.less'
;
const
ChangePasswordModal
=
props
=>
{
const
ChangePasswordModal
=
props
=>
{
const
{
visible
,
currentUser
,
currentSelectOrg
,
submitSearchUser
,
onSelect
,
onCancel
}
=
props
;
const
{
visible
,
currentUser
,
currentSelectOrg
,
submitSearchUser
,
onSelect
,
onCancel
}
=
props
;
const
[
passwordForm
]
=
Form
.
useForm
();
// 修改密码
const
[
passwordForm
]
=
Form
.
useForm
();
// 修改密码
const
[
newPasswordLevel
,
setNewPasswordLevel
]
=
useState
(
'
弱
'
);
const
[
newPasswordLevel
,
setNewPasswordLevel
]
=
useState
(
''
);
const
[
passwordConfirmLevel
,
setPasswordConfirmLevel
]
=
useState
(
'
弱
'
);
const
[
passwordConfirmLevel
,
setPasswordConfirmLevel
]
=
useState
(
''
);
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
currentUser
);
console
.
log
(
currentUser
);
if
(
visible
)
{
if
(
visible
)
{
...
@@ -104,17 +106,16 @@ const ChangePasswordModal = props => {
...
@@ -104,17 +106,16 @@ const ChangePasswordModal = props => {
case
1
:
case
1
:
return
'弱'
;
return
'弱'
;
case
2
:
case
2
:
return
'弱'
;
case
3
:
if
(
sValue
.
length
>
8
)
{
if
(
sValue
.
length
>
8
)
{
return
'中'
;
return
'中'
;
}
}
return
'弱'
;
return
'弱'
;
case
3
:
case
4
:
if
(
sValue
.
length
>
8
)
{
if
(
sValue
.
length
<
10
)
{
return
'强'
;
return
'中'
;
}
}
return
'中'
;
case
4
:
return
'强'
;
return
'强'
;
}
}
};
};
...
@@ -143,52 +144,68 @@ const ChangePasswordModal = props => {
...
@@ -143,52 +144,68 @@ const ChangePasswordModal = props => {
newPassword
:
''
,
newPassword
:
''
,
passwordConfirm
:
''
,
passwordConfirm
:
''
,
});
});
setNewPasswordLevel
(
''
);
setPasswordConfirmLevel
(
''
);
onCancel
();
onCancel
();
}
}
}
}
okText=
"确认"
okText=
"确认"
cancelText=
"取消"
cancelText=
"取消"
>
>
<
Form
form=
{
passwordForm
}
labelCol=
{
{
span
:
4
}
}
onFieldsChange=
{
changeValue
}
>
<
div
className=
{
styles
.
modalContent
}
>
<
Form
.
Item
name=
"oldPassword"
label=
"原始密码"
>
<
Form
form=
{
passwordForm
}
labelCol=
{
{
span
:
4
}
}
onFieldsChange=
{
changeValue
}
>
<
Input
disabled
/>
<
Form
.
Item
name=
"oldPassword"
label=
"原始密码"
>
</
Form
.
Item
>
<
Input
disabled
/>
<
Form
.
Item
</
Form
.
Item
>
name=
"newPassword"
<
div
className=
{
styles
.
formBox
}
>
label=
"新密码"
<
Form
.
Item
rules=
{
[
name=
"newPassword"
{
label=
"新密码"
pattern
:
/^
[
a-zA-Z0-9_
]
{6,16}$/
,
rules=
{
[
message
:
'长度6-16位,支持字母与数字,允许下划线'
,
{
},
pattern
:
/^
[
a-zA-Z0-9_
]
{6,16}$/
,
{
required
:
true
},
message
:
'长度6-16位,支持字母与数字,允许下划线'
,
]
}
},
>
{
required
:
true
},
<
Input
]
}
placeholder=
"请输入新密码"
>
autoComplete=
"off"
<
Input
placeholder=
"请输入新密码"
autoComplete=
"off"
maxLength=
"16"
/>
maxLength=
"16"
</
Form
.
Item
>
suffix=
{
newPasswordLevel
}
<
div
/>
className=
{
classNames
(
styles
.
tipsText
,
{
</
Form
.
Item
>
[
styles
.
tipsRed
]:
newPasswordLevel
===
'弱'
,
<
Form
.
Item
[
styles
.
tipsOrange
]:
newPasswordLevel
===
'中'
,
name=
"passwordConfirm"
[
styles
.
tipsGreen
]:
newPasswordLevel
===
'强'
,
label=
"确认密码"
})
}
rules=
{
[
>
{
{
newPasswordLevel
}
pattern
:
/^
[
a-zA-Z0-9_
]
{6,16}$/
,
</
div
>
message
:
'长度6-16位,支持字母与数字,允许下划线'
,
</
div
>
},
<
div
className=
{
styles
.
formBox
}
>
{
required
:
true
},
<
Form
.
Item
]
}
name=
"passwordConfirm"
>
label=
"确认密码"
<
Input
rules=
{
[
placeholder=
"再次确认新密码"
{
autoComplete=
"off"
pattern
:
/^
[
a-zA-Z0-9_
]
{6,16}$/
,
maxLength=
"16"
message
:
'长度6-16位,支持字母与数字,允许下划线'
,
suffix=
{
passwordConfirmLevel
}
},
/>
{
required
:
true
},
</
Form
.
Item
>
]
}
</
Form
>
>
<
Input
placeholder=
"再次确认新密码"
autoComplete=
"off"
maxLength=
"16"
/>
</
Form
.
Item
>
<
div
className=
{
classNames
(
styles
.
tipsText
,
{
[
styles
.
tipsRed
]:
passwordConfirmLevel
===
'弱'
,
[
styles
.
tipsOrange
]:
passwordConfirmLevel
===
'中'
,
[
styles
.
tipsGreen
]:
passwordConfirmLevel
===
'强'
,
})
}
>
{
passwordConfirmLevel
}
</
div
>
</
div
>
</
Form
>
</
div
>
</
Modal
>
</
Modal
>
);
);
};
};
...
...
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