重置密码功能
This commit is contained in:
parent
2181329316
commit
0f0199fd41
@ -25,7 +25,7 @@
|
||||
</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"
|
||||
placeholder="请设置密码(6-20个字符)" />
|
||||
</a-form-item>
|
||||
@ -297,11 +297,18 @@ const registerRules = {
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
// 4.1 检查密码是否完整包含用户名
|
||||
if (passwordLower.includes(username)) {
|
||||
if (passwordLower.includes(usernameLower)) {
|
||||
return Promise.reject("密码不能包含用户名");
|
||||
}
|
||||
|
||||
@ -309,14 +316,14 @@ const registerRules = {
|
||||
const passwordLetters = passwordLower.replace(/[^a-z]/g, '');
|
||||
|
||||
// 4.3 如果密码字母部分长度 >= 3,检查是否是用户名的子串
|
||||
if (passwordLetters.length >= 3 && username.includes(passwordLetters)) {
|
||||
if (passwordLetters.length >= 3 && usernameLower.includes(passwordLetters)) {
|
||||
return Promise.reject("密码的字母部分不能是用户名的子串");
|
||||
}
|
||||
|
||||
// 4.4 检查用户名中是否包含密码的任意连续3位字母
|
||||
for (let i = 0; i <= passwordLetters.length - 3; i++) {
|
||||
const substring = passwordLetters.substring(i, i + 3);
|
||||
if (username.includes(substring)) {
|
||||
if (usernameLower.includes(substring)) {
|
||||
return Promise.reject("密码不能与用户名存在明显关联");
|
||||
}
|
||||
}
|
||||
@ -801,7 +808,7 @@ const filterOption = (inputValue: string, option: any) => {
|
||||
}
|
||||
|
||||
: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
|
||||
|
||||
}
|
||||
|
||||
function closeResult(){
|
||||
resultPawss.value = false
|
||||
}
|
||||
//过去设施权限维护
|
||||
const fishway = ref(false)
|
||||
const userId = ref('')
|
||||
@ -1083,7 +1085,7 @@ function handleClearSelection() {
|
||||
</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">
|
||||
<el-form ref="auditFormRef" :model="auditForm" :rules="auditRules" label-width="80px">
|
||||
<el-form-item label="审批意见" prop="commentInfo">
|
||||
@ -1099,8 +1101,14 @@ function handleClearSelection() {
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 重置密码后的回显 -->
|
||||
<el-dialog v-model="resultPawss" width="500px" append-to-body :before-close="handleAuditClose">
|
||||
已将密码重置为{{ msgText }}
|
||||
<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>
|
||||
</template>
|
||||
|
||||
@ -251,9 +251,11 @@ function handleClose() {
|
||||
|
||||
//重置密码
|
||||
const userid = ref("");
|
||||
const resultPawss = ref(false)
|
||||
const msgText = ref('')
|
||||
function setpassword(row: any) {
|
||||
ElMessageBox.confirm(
|
||||
'确定将该账号密码重置为123456吗?',
|
||||
'确定要重置此账号密码吗?',
|
||||
'重置密码',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
@ -265,16 +267,23 @@ function setpassword(row: any) {
|
||||
const params = {
|
||||
id: userid.value
|
||||
}
|
||||
setpass(params).then(() => {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '密码重置成功',
|
||||
})
|
||||
setpass(params).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
resultPawss.value = true
|
||||
msgText.value = res.data
|
||||
}
|
||||
// ElMessage({
|
||||
// type: 'success',
|
||||
// message: '密码重置成功',
|
||||
// })
|
||||
})
|
||||
})
|
||||
userid.value = row.id
|
||||
|
||||
}
|
||||
function closeResult() {
|
||||
resultPawss.value = false
|
||||
}
|
||||
|
||||
//过去设施权限维护
|
||||
const fishway = ref(false)
|
||||
@ -769,8 +778,8 @@ onMounted(() => {
|
||||
getdictdata()
|
||||
});
|
||||
const dictData = ref([])
|
||||
function getdictdata(){
|
||||
getDictItemsByCode({dictCode:'resourceType'}).then(res=>{
|
||||
function getdictdata() {
|
||||
getDictItemsByCode({ dictCode: 'resourceType' }).then(res => {
|
||||
dictData.value = res.data
|
||||
})
|
||||
}
|
||||
@ -1026,8 +1035,7 @@ function handleClearSelection() {
|
||||
<div class="fishBody">
|
||||
<div class="fishTree">
|
||||
<div style="width: 100%;padding: 0px 10px; box-sizing: border-box;">
|
||||
<el-input v-model="treeInput" style="width: 100%" placeholder="请输入电站名称" clearable
|
||||
class="input-with-select">
|
||||
<el-input v-model="treeInput" style="width: 100%" placeholder="请输入电站名称" clearable class="input-with-select">
|
||||
<template #append>
|
||||
<el-button :icon="Search" @click="getFishTree()" />
|
||||
</template>
|
||||
@ -1057,7 +1065,7 @@ function handleClearSelection() {
|
||||
<el-table-column prop="name" label="名称"></el-table-column>
|
||||
<el-table-column prop="type" label="类型" width="200" align="center">
|
||||
<template #default="scope">
|
||||
<span>{{ getName(dictData,scope.row.type) }}</span>
|
||||
<span>{{ getName(dictData, scope.row.type) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="id" label="权限" align="center" width="200">
|
||||
@ -1078,6 +1086,16 @@ function handleClearSelection() {
|
||||
<el-button type="primary" @click="fishSure">保存</el-button>
|
||||
</span>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user