From e05dfae9f4199bb6c34313a098b84385cedf470e Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Tue, 8 Oct 2024 15:14:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=86=E7=A0=81=E7=AD=96=E7=95=A5=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 8 +- src/api/system/password/index.ts | 29 +++++ src/views/login/components/LoginForm.vue | 14 +++ src/views/system/passwordRule/index.vue | 153 +++++++++++++++++++++++ 4 files changed, 200 insertions(+), 4 deletions(-) create mode 100644 src/api/system/password/index.ts create mode 100644 src/views/system/passwordRule/index.vue diff --git a/.env.development b/.env.development index 5c1f646..ee1bd4e 100644 --- a/.env.development +++ b/.env.development @@ -4,11 +4,11 @@ NODE_ENV=development VITE_DEV=false # 请求路径 -VITE_BASE_URL='http://localhost:12080' +VITE_BASE_URL='http://192.168.0.159:12080' # VITE_BASE_URL='http://192.168.0.165:12080' # 上传路径 -VITE_UPLOAD_URL='http://localhost:12080/admin-api/infra/file/upload' +VITE_UPLOAD_URL='http://192.168.0.159:12080/admin-api/infra/file/upload' # 接口前缀 VITE_API_BASEPATH=/dev-api @@ -32,7 +32,7 @@ VITE_SOURCEMAP=false VITE_OUT_DIR=dist # 自定义接口路径 -VITE_INTERFACE_URL='http://localhost:12080/magic/web/index.html' +VITE_INTERFACE_URL='http://192.168.0.159:12080/magic/web/index.html' # 积木报表请求路径 -VITE_JMREPORT_BASE_URL='http://localhost:12080' \ No newline at end of file +VITE_JMREPORT_BASE_URL='http://192.168.0.159:12080' \ No newline at end of file diff --git a/src/api/system/password/index.ts b/src/api/system/password/index.ts new file mode 100644 index 0000000..9f07574 --- /dev/null +++ b/src/api/system/password/index.ts @@ -0,0 +1,29 @@ +import request from '@/config/axios' + +export interface PassWordConfigVO { + id: number + status: boolean + ruleLevel: string + ruleDesc: string + tryCount: number + lockMinutes: number + updatePeriod: number +} +// 获取密码策略 +export const getConfig = () => { + return request.get({ url: '/system/password/getConfig' }) +} + +// 设置密码策略 +export const setConfig = (data: PassWordConfigVO) => { + return request.post({ url: '/system/password/setConfig', data }) +} + +// 获取密码复杂度 +export const getRuleList = () => { + return request.get({ url: '/system/password/getRuleList'}) +} +// 验证密码是否过期 +export const validateResetTime = (userId:number) => { + return request.get({ url: '/system/password/validateResetTime?userId=' + userId}) +} diff --git a/src/views/login/components/LoginForm.vue b/src/views/login/components/LoginForm.vue index 3f15bb8..819e9bb 100644 --- a/src/views/login/components/LoginForm.vue +++ b/src/views/login/components/LoginForm.vue @@ -86,6 +86,7 @@ import { usePermissionStore } from '@/store/modules/permission' import * as LoginApi from '@/api/login' import { LoginStateEnum, useFormValid, useLoginState } from './useLogin' import { getCodeImg } from "@/api/login"; +import * as PassWordApi from '@/api/system/password' defineOptions({ name: 'LoginForm' }) @@ -187,6 +188,19 @@ const handleLogin = async (params) => { return } const res = await LoginApi.login(loginData.loginForm) + try{ + await PassWordApi.validateResetTime(res.userId) + }catch (e) { + if (e.code === 1002000010) { + await ElMessageBox.alert( + '密码长时间未修改,存在安全隐患,请及时修改', + '重要提示', + { + dangerouslyUseHTMLString: true, + } + ) + } + } if (!res) { getCode() return diff --git a/src/views/system/passwordRule/index.vue b/src/views/system/passwordRule/index.vue new file mode 100644 index 0000000..d5f964e --- /dev/null +++ b/src/views/system/passwordRule/index.vue @@ -0,0 +1,153 @@ + + +