重置密码功能
This commit is contained in:
parent
2181329316
commit
0f0199fd41
@ -25,7 +25,7 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<!-- 密码 -->
|
<!-- 密码 -->
|
||||||
<a-form-item name="password" label="密 码">
|
<a-form-item name="password" label="密 码" :dependencies="['username']">
|
||||||
<a-input-password v-model:value="registerData.password"
|
<a-input-password v-model:value="registerData.password"
|
||||||
placeholder="请设置密码(6-20个字符)" />
|
placeholder="请设置密码(6-20个字符)" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@ -297,11 +297,18 @@ const registerRules = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4. 用户名关联检查(严格模式,忽略大小写)
|
// 4. 用户名关联检查(严格模式,忽略大小写)
|
||||||
const username = registerData.username.toLowerCase();
|
// 4.0 先判断用户名是否为空,若为空则跳过该检查
|
||||||
|
const username = registerData.username;
|
||||||
|
if (!username || username.trim() === '') {
|
||||||
|
// 用户名为空,跳过用户名关联检查
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
const usernameLower = username.toLowerCase();
|
||||||
const passwordLower = value.toLowerCase();
|
const passwordLower = value.toLowerCase();
|
||||||
|
|
||||||
// 4.1 检查密码是否完整包含用户名
|
// 4.1 检查密码是否完整包含用户名
|
||||||
if (passwordLower.includes(username)) {
|
if (passwordLower.includes(usernameLower)) {
|
||||||
return Promise.reject("密码不能包含用户名");
|
return Promise.reject("密码不能包含用户名");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,14 +316,14 @@ const registerRules = {
|
|||||||
const passwordLetters = passwordLower.replace(/[^a-z]/g, '');
|
const passwordLetters = passwordLower.replace(/[^a-z]/g, '');
|
||||||
|
|
||||||
// 4.3 如果密码字母部分长度 >= 3,检查是否是用户名的子串
|
// 4.3 如果密码字母部分长度 >= 3,检查是否是用户名的子串
|
||||||
if (passwordLetters.length >= 3 && username.includes(passwordLetters)) {
|
if (passwordLetters.length >= 3 && usernameLower.includes(passwordLetters)) {
|
||||||
return Promise.reject("密码的字母部分不能是用户名的子串");
|
return Promise.reject("密码的字母部分不能是用户名的子串");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4.4 检查用户名中是否包含密码的任意连续3位字母
|
// 4.4 检查用户名中是否包含密码的任意连续3位字母
|
||||||
for (let i = 0; i <= passwordLetters.length - 3; i++) {
|
for (let i = 0; i <= passwordLetters.length - 3; i++) {
|
||||||
const substring = passwordLetters.substring(i, i + 3);
|
const substring = passwordLetters.substring(i, i + 3);
|
||||||
if (username.includes(substring)) {
|
if (usernameLower.includes(substring)) {
|
||||||
return Promise.reject("密码不能与用户名存在明显关联");
|
return Promise.reject("密码不能与用户名存在明显关联");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -801,7 +808,7 @@ const filterOption = (inputValue: string, option: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:deep(.ant-form-item) {
|
:deep(.ant-form-item) {
|
||||||
margin-bottom: clamp(8px, 1vh, 14px);
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -829,5 +836,4 @@ const filterOption = (inputValue: string, option: any) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}</style>
|
||||||
</style>
|
|
||||||
|
|||||||
@ -204,7 +204,9 @@ function setpassword(row: any) {
|
|||||||
userid.value = row.id
|
userid.value = row.id
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function closeResult(){
|
||||||
|
resultPawss.value = false
|
||||||
|
}
|
||||||
//过去设施权限维护
|
//过去设施权限维护
|
||||||
const fishway = ref(false)
|
const fishway = ref(false)
|
||||||
const userId = ref('')
|
const userId = ref('')
|
||||||
@ -1083,7 +1085,7 @@ function handleClearSelection() {
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 审批意见对话框 -->
|
<!-- 审批意见对话框 -->
|
||||||
<el-dialog v-model="auditDialogVisible" :title="auditType === 'APPROVED' ? '审批通过' : '审批驳回'" width="500px"
|
<el-dialog v-model="auditDialogVisible" :close-on-click-modal="false" :title="auditType === 'APPROVED' ? '审批通过' : '审批驳回'" width="500px"
|
||||||
append-to-body :before-close="handleAuditClose">
|
append-to-body :before-close="handleAuditClose">
|
||||||
<el-form ref="auditFormRef" :model="auditForm" :rules="auditRules" label-width="80px">
|
<el-form ref="auditFormRef" :model="auditForm" :rules="auditRules" label-width="80px">
|
||||||
<el-form-item label="审批意见" prop="commentInfo">
|
<el-form-item label="审批意见" prop="commentInfo">
|
||||||
@ -1099,8 +1101,14 @@ function handleClearSelection() {
|
|||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!-- 重置密码后的回显 -->
|
<!-- 重置密码后的回显 -->
|
||||||
<el-dialog v-model="resultPawss" width="500px" append-to-body :before-close="handleAuditClose">
|
<el-dialog v-model="resultPawss" :close-on-click-modal="false" title="重置成功" width="500px" append-to-body :before-close="closeResult">
|
||||||
已将密码重置为{{ msgText }}
|
已将密码重置为:<span style="color: #409eff;font-size: 16px;">{{ msgText }}</span>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="closeResult">取消</el-button>
|
||||||
|
<el-button type="primary" @click="closeResult">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -251,9 +251,11 @@ function handleClose() {
|
|||||||
|
|
||||||
//重置密码
|
//重置密码
|
||||||
const userid = ref("");
|
const userid = ref("");
|
||||||
|
const resultPawss = ref(false)
|
||||||
|
const msgText = ref('')
|
||||||
function setpassword(row: any) {
|
function setpassword(row: any) {
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
'确定将该账号密码重置为123456吗?',
|
'确定要重置此账号密码吗?',
|
||||||
'重置密码',
|
'重置密码',
|
||||||
{
|
{
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@ -265,16 +267,23 @@ function setpassword(row: any) {
|
|||||||
const params = {
|
const params = {
|
||||||
id: userid.value
|
id: userid.value
|
||||||
}
|
}
|
||||||
setpass(params).then(() => {
|
setpass(params).then((res: any) => {
|
||||||
ElMessage({
|
if (res.code == 0) {
|
||||||
type: 'success',
|
resultPawss.value = true
|
||||||
message: '密码重置成功',
|
msgText.value = res.data
|
||||||
})
|
}
|
||||||
|
// ElMessage({
|
||||||
|
// type: 'success',
|
||||||
|
// message: '密码重置成功',
|
||||||
|
// })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
userid.value = row.id
|
userid.value = row.id
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function closeResult() {
|
||||||
|
resultPawss.value = false
|
||||||
|
}
|
||||||
|
|
||||||
//过去设施权限维护
|
//过去设施权限维护
|
||||||
const fishway = ref(false)
|
const fishway = ref(false)
|
||||||
@ -1026,8 +1035,7 @@ function handleClearSelection() {
|
|||||||
<div class="fishBody">
|
<div class="fishBody">
|
||||||
<div class="fishTree">
|
<div class="fishTree">
|
||||||
<div style="width: 100%;padding: 0px 10px; box-sizing: border-box;">
|
<div style="width: 100%;padding: 0px 10px; box-sizing: border-box;">
|
||||||
<el-input v-model="treeInput" style="width: 100%" placeholder="请输入电站名称" clearable
|
<el-input v-model="treeInput" style="width: 100%" placeholder="请输入电站名称" clearable class="input-with-select">
|
||||||
class="input-with-select">
|
|
||||||
<template #append>
|
<template #append>
|
||||||
<el-button :icon="Search" @click="getFishTree()" />
|
<el-button :icon="Search" @click="getFishTree()" />
|
||||||
</template>
|
</template>
|
||||||
@ -1078,6 +1086,16 @@ function handleClearSelection() {
|
|||||||
<el-button type="primary" @click="fishSure">保存</el-button>
|
<el-button type="primary" @click="fishSure">保存</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog v-model="resultPawss" :close-on-click-modal="false" title="重置成功" width="500px" append-to-body
|
||||||
|
:before-close="closeResult">
|
||||||
|
已将密码重置为:<span style="color: #409eff;font-size: 16px;">{{ msgText }}</span>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="closeResult">取消</el-button>
|
||||||
|
<el-button type="primary" @click="closeResult">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user