【新增】 新增中心服务器当用户登录的时候,使用管理员密码进行强制登出
This commit is contained in:
@@ -36,6 +36,11 @@ export const loginOut = () => {
|
|||||||
return request.post({ url: '/system/auth/logout' })
|
return request.post({ url: '/system/auth/logout' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 强制登出
|
||||||
|
export const refreshLogout = (data: any) => {
|
||||||
|
return request.post({ url: '/system/auth/refreshLogout', data })
|
||||||
|
}
|
||||||
|
|
||||||
// 获取用户权限信息
|
// 获取用户权限信息
|
||||||
export const getInfo = () => {
|
export const getInfo = () => {
|
||||||
return request.get({ url: '/system/auth/get-permission-info' })
|
return request.get({ url: '/system/auth/get-permission-info' })
|
||||||
|
@@ -149,6 +149,39 @@
|
|||||||
<!-- </el-col>-->
|
<!-- </el-col>-->
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
<el-dialog
|
||||||
|
v-model="isTrueLoginForAdmin"
|
||||||
|
title="提示"
|
||||||
|
width="500"
|
||||||
|
:before-close="handleClose"
|
||||||
|
>
|
||||||
|
<span>是否使用管理员密码强制退出该用户</span>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="isTrueLoginForAdmin = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="openLoginForAdminPassWord()">
|
||||||
|
确定
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
v-model="isTrueLoginForAdminPassWord"
|
||||||
|
title="提示"
|
||||||
|
width="500"
|
||||||
|
:before-close="handleClose"
|
||||||
|
>
|
||||||
|
<span>管理员密码:</span>
|
||||||
|
<el-input v-model="adminPassword" style="width: 240px" placeholder="请输入管理员密码" />
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="isTrueLoginForAdminPassWord = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="loginOutAdminPassword()">
|
||||||
|
确定
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ElLoading } from 'element-plus'
|
import { ElLoading } from 'element-plus'
|
||||||
@@ -164,6 +197,11 @@ import { LoginStateEnum, useFormValid, useLoginState } from './useLogin'
|
|||||||
|
|
||||||
defineOptions({ name: 'LoginForm' })
|
defineOptions({ name: 'LoginForm' })
|
||||||
|
|
||||||
|
const isTrueLoginForAdmin = ref(false)
|
||||||
|
const isTrueLoginForAdminPassWord = ref(false)
|
||||||
|
const adminPassword = ref('')
|
||||||
|
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const iconHouse = useIcon({ icon: 'ep:house' })
|
const iconHouse = useIcon({ icon: 'ep:house' })
|
||||||
@@ -180,7 +218,15 @@ const verify = ref()
|
|||||||
const captchaType = ref('blockPuzzle') // blockPuzzle 滑块 clickWord 点击文字
|
const captchaType = ref('blockPuzzle') // blockPuzzle 滑块 clickWord 点击文字
|
||||||
|
|
||||||
const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN)
|
const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN)
|
||||||
|
const handleClose = (done: () => void) => {
|
||||||
|
ElMessageBox.confirm('检测您鼠标没有正确点击,确定要关闭?')
|
||||||
|
.then(() => {
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// catch error
|
||||||
|
})
|
||||||
|
}
|
||||||
const LoginRules = {
|
const LoginRules = {
|
||||||
tenantName: [required],
|
tenantName: [required],
|
||||||
username: [required],
|
username: [required],
|
||||||
@@ -225,6 +271,27 @@ const getTenantId = async () => {
|
|||||||
authUtil.setTenantId(res)
|
authUtil.setTenantId(res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 使用管理员密码登出登录的账号
|
||||||
|
const openLoginForAdminPassWord = () => {
|
||||||
|
isTrueLoginForAdmin.value = false
|
||||||
|
isTrueLoginForAdminPassWord.value = true
|
||||||
|
}
|
||||||
|
const loginOutAdminPassword = async () => {
|
||||||
|
const data = {
|
||||||
|
loginOutPassword: adminPassword.value,
|
||||||
|
username: loginData.loginForm.username
|
||||||
|
}
|
||||||
|
LoginApi.refreshLogout(data).then((res) => {
|
||||||
|
if (res) {
|
||||||
|
message.success(res)
|
||||||
|
isTrueLoginForAdmin.value = false
|
||||||
|
isTrueLoginForAdminPassWord.value = false
|
||||||
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
message.error(err.msg)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 记住我
|
// 记住我
|
||||||
const getLoginFormCache = () => {
|
const getLoginFormCache = () => {
|
||||||
const loginForm = authUtil.getLoginForm()
|
const loginForm = authUtil.getLoginForm()
|
||||||
@@ -285,6 +352,8 @@ const handleLogin = async (params: any) => {
|
|||||||
await push({ path: redirect.value || permissionStore.addRouters[0].path })
|
await push({ path: redirect.value || permissionStore.addRouters[0].path })
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
// 弹出输入管理员密码并重新进行登录
|
||||||
|
isTrueLoginForAdmin.value = true
|
||||||
loginLoading.value = false
|
loginLoading.value = false
|
||||||
loading.value.close()
|
loading.value.close()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user