Merge branch 'master' of https://gitea.zianxin.com/zianxin/pj_admin_cloud
build / task (16.x, npm, macOS-latest) (push) Canceled after 0s
build / task (16.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, npm, windows-latest) (push) Canceled after 0s
build / task (16.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (16.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (16.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (16.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, yarn, windows-latest) (push) Canceled after 0s
build / task (18.x, npm, macOS-latest) (push) Canceled after 0s
build / task (18.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, npm, windows-latest) (push) Canceled after 0s
build / task (18.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (18.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (18.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (18.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, yarn, windows-latest) (push) Canceled after 0s
build / task (20.x, npm, macOS-latest) (push) Canceled after 0s
build / task (20.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, npm, windows-latest) (push) Canceled after 0s
build / task (20.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (20.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (20.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (20.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, yarn, windows-latest) (push) Canceled after 0s
build / task (16.x, npm, macOS-latest) (push) Canceled after 0s
build / task (16.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, npm, windows-latest) (push) Canceled after 0s
build / task (16.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (16.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (16.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (16.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, yarn, windows-latest) (push) Canceled after 0s
build / task (18.x, npm, macOS-latest) (push) Canceled after 0s
build / task (18.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, npm, windows-latest) (push) Canceled after 0s
build / task (18.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (18.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (18.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (18.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, yarn, windows-latest) (push) Canceled after 0s
build / task (20.x, npm, macOS-latest) (push) Canceled after 0s
build / task (20.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, npm, windows-latest) (push) Canceled after 0s
build / task (20.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (20.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (20.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (20.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, yarn, windows-latest) (push) Canceled after 0s
This commit is contained in:
commit
528f2e0b3d
2 files changed
+11
-131
No files matched your search
@@ -170,7 +170,7 @@ export function getSimpleUserAll(params?: { name?: string; mobile?: string; user
|
||||
/** 按原筛选条件提交后台分批导出。 */
|
||||
export const submitUserExport = (query: Record<string, unknown>) => submitExportTask("/admin/user/export-async", query)
|
||||
|
||||
/** 异步修复「密码=手机号」弱口令,返回任务进度(轮询 /admin/async-task/progress) */
|
||||
/** 线上已执行完,暂时关闭修复弱口令接口
|
||||
export const fixPhoneAsPassword = (password: string) => {
|
||||
return request({
|
||||
url: "/admin/user/fix-phone-as-password",
|
||||
@@ -178,3 +178,4 @@ export const fixPhoneAsPassword = (password: string) => {
|
||||
data: { password },
|
||||
})
|
||||
}
|
||||
*/
|
||||
@@ -75,6 +75,7 @@
|
||||
>
|
||||
审批
|
||||
</el-button>
|
||||
<!-- 线上已执行完,暂时注释入口
|
||||
<el-button
|
||||
plain
|
||||
v-auth="'sys_user_edit'"
|
||||
@@ -86,6 +87,7 @@
|
||||
>
|
||||
修复弱口令
|
||||
</el-button>
|
||||
-->
|
||||
<div class="flex justify-between items-center">
|
||||
<el-tabs class="flex-1" v-model="activeName" @tab-click="handleClickTabItem">
|
||||
<el-tab-pane v-for="v in tabItems" :key="v.id" :label="v.label" :name="v.value" />
|
||||
@@ -236,33 +238,17 @@
|
||||
<!-- 批量审批对话框 -->
|
||||
<batch-deal ref="batchDealRef" @task-submit-event="taskSubmitEvent" />
|
||||
|
||||
<!-- 修复弱口令:输入统一新密码 -->
|
||||
<!-- 线上已执行完,暂时注释修复弱口令入口
|
||||
<el-dialog v-model="fixWeakPwdVisible" title="修复弱口令(密码=手机号)" width="480px" destroy-on-close>
|
||||
<el-alert type="warning" :closable="false" show-icon class="mb15" title="将后台异步扫描并重置所有「密码等于手机号」的账号;完成后可下载名单发公告。人多时请耐心等待进度。" />
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="统一新密码" required>
|
||||
<el-input v-model="fixWeakPwdForm.password" type="password" show-password placeholder="字母+数字,至少8位,且不能等于任何用户手机号/用户名" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="fixWeakPwdVisible = false">取消</el-button>
|
||||
<el-button type="warning" :loading="fixWeakPwdLoading" @click="submitFixWeakPwd">确认执行</el-button>
|
||||
</template>
|
||||
...
|
||||
</el-dialog>
|
||||
|
||||
<!-- 修复结果名单(可复制发公告) -->
|
||||
<el-dialog v-model="fixWeakPwdResultVisible" title="弱口令修复结果" width="640px" destroy-on-close>
|
||||
<p class="mb10">{{ fixWeakPwdResultMessage }}</p>
|
||||
<el-input v-model="fixWeakPwdResultText" type="textarea" :rows="12" readonly placeholder="若名单未自动加载,请点「下载名单」打开 txt 后复制发公告" />
|
||||
<template #footer>
|
||||
<el-button v-if="fixWeakPwdResultFileUrl" type="primary" @click="downloadFixWeakPwdResult">下载名单</el-button>
|
||||
<el-button type="primary" :disabled="!fixWeakPwdResultText" @click="copyFixWeakPwdResult">复制名单</el-button>
|
||||
<el-button @click="fixWeakPwdResultVisible = false">关闭</el-button>
|
||||
</template>
|
||||
...
|
||||
</el-dialog>
|
||||
<async-task-progress-component ref="fixWeakPwdProgressRef" :config="fixWeakPwdTaskConfig" @success="handleFixWeakPwdSuccess" @failure="handleFixWeakPwdFailure" />
|
||||
-->
|
||||
|
||||
<async-task-progress-component ref="exportProgressRef" :config="exportTaskConfig" @success="handleExportSuccess" @failure="handleExportFailure" />
|
||||
<async-task-progress-component ref="fixWeakPwdProgressRef" :config="fixWeakPwdTaskConfig" @success="handleFixWeakPwdSuccess" @failure="handleFixWeakPwdFailure" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -270,9 +256,8 @@
|
||||
import AsyncTaskProgressComponent from "/@/components/AsyncTaskProgress.vue"
|
||||
import { useBatchExport } from "/@/hooks/batchExport"
|
||||
import { submitUserExport as submitBatchExport } from "/@/api/admin/user"
|
||||
import type { AsyncTaskPollingConfig, AsyncTaskProgress } from "/@/api/asyncTask"
|
||||
|
||||
import { delObj, pageList, putObj, fixPhoneAsPassword } from "/@/api/admin/user"
|
||||
import { delObj, pageList, putObj } from "/@/api/admin/user"
|
||||
import { putGlobalFace } from "/@/api/admin/userFace"
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
@@ -281,8 +266,6 @@ import { auth } from "/@/utils/authFunction"
|
||||
import { getDicts } from "/@/api/admin/dict"
|
||||
import ProcessDrawer from "/@/components/processDrawer/index.vue"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { downloadExportFile } from "/@/utils/exportDownload"
|
||||
import other from "/@/utils/other"
|
||||
|
||||
const UserForm = defineAsyncComponent(() => import("./form.vue"))
|
||||
const FaceManage = defineAsyncComponent(() => import("./face-manage.vue"))
|
||||
@@ -444,109 +427,5 @@ const changePassword = async (row: any) => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const fixWeakPwdVisible = ref(false)
|
||||
const fixWeakPwdLoading = ref(false)
|
||||
const fixWeakPwdForm = reactive({ password: "" })
|
||||
const fixWeakPwdResultVisible = ref(false)
|
||||
const fixWeakPwdResultMessage = ref("")
|
||||
const fixWeakPwdResultText = ref("")
|
||||
const fixWeakPwdResultFileUrl = ref("")
|
||||
const fixWeakPwdResultFileName = ref("弱口令修复名单.txt")
|
||||
const fixWeakPwdProgressRef = ref<InstanceType<typeof AsyncTaskProgressComponent>>()
|
||||
const fixWeakPwdTaskConfig: AsyncTaskPollingConfig = {
|
||||
progressUrl: "/admin/async-task/progress",
|
||||
redisKey: "admin:fix:phone-password",
|
||||
waitingMessage: "正在后台分页扫描用户密码,人多时可能较久,请勿关闭页面",
|
||||
downloadButtonText: "下载名单",
|
||||
pollTimeoutMs: 6 * 60 * 60 * 1000,
|
||||
}
|
||||
|
||||
const openFixWeakPwdDialog = () => {
|
||||
fixWeakPwdForm.password = ""
|
||||
fixWeakPwdVisible.value = true
|
||||
}
|
||||
|
||||
const resolveFileAbsoluteUrl = (fileUrl: string) => {
|
||||
if (!fileUrl) return ""
|
||||
if (/^https?:\/\//i.test(fileUrl)) return fileUrl
|
||||
return `${String(import.meta.env.VITE_API_URL || "").replace(/\/$/, "")}${other.adaptationUrl(fileUrl)}`
|
||||
}
|
||||
|
||||
const submitFixWeakPwd = async () => {
|
||||
const pwd = (fixWeakPwdForm.password || "").trim()
|
||||
if (!pwd || pwd.length < 8) {
|
||||
useMessage().error("新密码长度不能少于8位")
|
||||
return
|
||||
}
|
||||
if (!/[A-Za-z]/.test(pwd) || !/[0-9]/.test(pwd)) {
|
||||
useMessage().error("新密码必须同时包含字母和数字")
|
||||
return
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("确认将所有「密码=手机号」账号重置为该统一新密码?此操作不可撤销,将在后台异步执行。")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
fixWeakPwdLoading.value = true
|
||||
fixWeakPwdProgressRef.value?.startSubmitting("修复弱口令")
|
||||
try {
|
||||
const { data } = await fixPhoneAsPassword(pwd)
|
||||
if (!data?.taskId) throw new Error("任务响应缺少任务 ID")
|
||||
fixWeakPwdVisible.value = false
|
||||
fixWeakPwdProgressRef.value?.start(data)
|
||||
} catch (err: any) {
|
||||
const message = err.msg || err.message || "修复任务提交失败"
|
||||
fixWeakPwdProgressRef.value?.submissionFailed(message)
|
||||
useMessage().error(message)
|
||||
} finally {
|
||||
fixWeakPwdLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleFixWeakPwdSuccess = async (progress: AsyncTaskProgress) => {
|
||||
fixWeakPwdResultMessage.value = progress.message || "修复完成"
|
||||
fixWeakPwdResultFileUrl.value = progress.resultFileUrl || ""
|
||||
fixWeakPwdResultFileName.value = progress.resultFileName || "弱口令修复名单.txt"
|
||||
fixWeakPwdResultText.value = ""
|
||||
if (progress.resultFileUrl) {
|
||||
try {
|
||||
downloadExportFile(progress.resultFileUrl, fixWeakPwdResultFileName.value)
|
||||
} catch {
|
||||
/* 下载失败仍展示结果弹窗 */
|
||||
}
|
||||
try {
|
||||
const abs = resolveFileAbsoluteUrl(progress.resultFileUrl)
|
||||
const resp = await fetch(abs)
|
||||
if (resp.ok) {
|
||||
fixWeakPwdResultText.value = await resp.text()
|
||||
}
|
||||
} catch {
|
||||
/* 跨域或鉴权失败时靠下载的 txt */
|
||||
}
|
||||
}
|
||||
fixWeakPwdResultVisible.value = true
|
||||
useMessage().success(progress.message || "修复完成")
|
||||
}
|
||||
|
||||
const handleFixWeakPwdFailure = (progress: AsyncTaskProgress) => {
|
||||
useMessage().error(progress.message || "修复弱口令失败")
|
||||
}
|
||||
|
||||
const downloadFixWeakPwdResult = () => {
|
||||
if (!fixWeakPwdResultFileUrl.value) return
|
||||
try {
|
||||
downloadExportFile(fixWeakPwdResultFileUrl.value, fixWeakPwdResultFileName.value)
|
||||
} catch (error: any) {
|
||||
useMessage().error(error?.message || "下载名单失败")
|
||||
}
|
||||
}
|
||||
|
||||
const copyFixWeakPwdResult = async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(fixWeakPwdResultText.value)
|
||||
useMessage().success("名单已复制")
|
||||
} catch {
|
||||
useMessage().error("复制失败,请手动全选复制或下载名单")
|
||||
}
|
||||
}
|
||||
// 线上已执行完,暂时注释修复弱口令入口相关逻辑(按钮/弹窗/异步进度)
|
||||
</script>
|
||||
Reference in new issue
Block a user