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 @@ + + +