Commit 26e56baa authored by 邓超's avatar 邓超

fix: 修改新增用户密码正则

parent 129171c3
......@@ -15,7 +15,7 @@ const AddUserModal = props => {
useEffect(() => {
addUserForm.resetFields();
console.log(orgID)
console.log(orgID);
}, [orgID]);
// 提交-添加用户
......@@ -36,17 +36,17 @@ const AddUserModal = props => {
message: '提交失败',
description: '登录名不支持中文!',
});
}else if (password === '') {
} else if (password === '') {
notification.error({
message: '提交失败',
description: '密码不能为空!',
});
}else if (password.length < 6) {
} else if (password.length < 6) {
notification.error({
message: '提交失败',
description: '密码至少为6位,且包含数字和字母!',
});
}else if (userName === '') {
} else if (userName === '') {
notification.error({
message: '提交失败',
description: '用户名称不能为空!',
......@@ -72,7 +72,7 @@ const AddUserModal = props => {
) {
addUser({ OUID: orgID.id, loginName, userName, password, phone, email })
.then(res => {
if (res.code===0) {
if (res.code === 0) {
addUserForm.resetFields();
onCancel(); // 设置Modal不可见
notification.success({
......@@ -103,52 +103,58 @@ const AddUserModal = props => {
cancelText="取消"
>
<Form form={addUserForm} labelCol={{ span: 4 }}>
<span style={{position: 'absolute', top: '21%', color: 'red', fontSize: '16px'}}>*</span>
<span style={{ position: 'absolute', top: '21%', color: 'red', fontSize: '16px' }}>*</span>
<Form.Item
hasFeedback
hasFeedback
name="loginName"
label="登录名称"
rules={[{
pattern:new RegExp(/^[^\u4e00-\u9fa5]+$/),
message: '不支持中文' },
{
pattern: new RegExp(/^[^\s]*$/),
message: '不能为空' }
rules={[
{
pattern: new RegExp(/^[^\u4e00-\u9fa5]+$/),
message: '不支持中文',
},
{
pattern: new RegExp(/^[^\s]*$/),
message: '不能为空',
},
]}
>
<Input placeholder="登录名称不支持中文" />
</Form.Item>
<span style={{position: 'absolute', top: '35%', color: 'red', fontSize: '16px'}}>*</span>
<span style={{ position: 'absolute', top: '35%', color: 'red', fontSize: '16px' }}>*</span>
<Form.Item
hasFeedback
hasFeedback
name="password"
label="账户密码"
rules={[{
pattern: /^[^\s]*$/,
message: '不能为空'
},
{
pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/,
message: '密码长度必须大于6,且必须包含数字和字母'
}
]
}
rules={[
{
pattern: /^[^\s]*$/,
message: '不能为空',
},
{
pattern: /(?=.*([a-zA-Z].*))(?=.*[0-9].*)[a-zA-Z0-9-*/+.~!@#$%^&*()]{6,20}$/,
message: '密码长度必须大于6,且必须包含数字和字母',
},
]}
>
<Input placeholder="请输入账户密码,至少6位" />
</Form.Item>
<span style={{position: 'absolute', top: '49%', color: 'red', fontSize: '16px'}}>*</span>
<span style={{ position: 'absolute', top: '49%', color: 'red', fontSize: '16px' }}>*</span>
<Form.Item
hasFeedback
hasFeedback
name="userName"
label="用户名称"
rules={[{
pattern: /^[^\s]*$/,
message: '不能为空' }]}
rules={[
{
pattern: /^[^\s]*$/,
message: '不能为空',
},
]}
>
<Input placeholder="请输入用户姓名" />
</Form.Item>
<Form.Item
hasFeedback
hasFeedback
name="phone"
label="手机号码"
rules={[
......@@ -161,7 +167,7 @@ const AddUserModal = props => {
<Input placeholder="请输入11位手机号码" autoComplete="off" />
</Form.Item>
<Form.Item
hasFeedback
hasFeedback
name="email"
label="电子邮箱"
rules={[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment