mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 09:17:06 +08:00
perf: Login api entrypt password
This commit is contained in:
Vendored
+1
@@ -8,4 +8,5 @@ export {}
|
||||
declare global {
|
||||
const ElMessage: typeof import('element-plus-secondary/es')['ElMessage']
|
||||
const ElMessageBox: typeof import('element-plus-secondary/es')['ElMessageBox']
|
||||
const LicenseGenerator: any
|
||||
}
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
import { request } from '@/utils/request'
|
||||
|
||||
export const AuthApi = {
|
||||
login: (credentials: { username: string; password: string }) =>
|
||||
request.post<{
|
||||
login: (credentials: { username: string; password: string }) => {
|
||||
const entryCredentials = {
|
||||
username: LicenseGenerator.sqlbotEncrypt(credentials.username),
|
||||
password: LicenseGenerator.sqlbotEncrypt(credentials.password),
|
||||
}
|
||||
return request.post<{
|
||||
data: any
|
||||
token: string
|
||||
}>('/login/access-token', credentials, {
|
||||
}>('/login/access-token', entryCredentials, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
}),
|
||||
})
|
||||
},
|
||||
logout: () => request.post('/auth/logout'),
|
||||
info: () => request.get('/user/info'),
|
||||
}
|
||||
|
||||
@@ -50,12 +50,10 @@ const loadXpackStatic = () => {
|
||||
if (document.getElementById('sqlbot_xpack_static')) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
const url = '/xpack_static/license-generator.umd.js'
|
||||
const url = `/xpack_static/license-generator.umd.js?t=${Date.now()}`
|
||||
return new Promise((resolve, reject) => {
|
||||
request
|
||||
.loadRemoteScript(url, 'sqlbot_xpack_static', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
LicenseGenerator?.init(import.meta.env.VITE_API_BASE_URL).then(() => {
|
||||
resolve(true)
|
||||
})
|
||||
|
||||
@@ -99,8 +99,7 @@ class HttpService {
|
||||
// Skip auth for xpack_static requests
|
||||
return config
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
|
||||
const request_key = LicenseGenerator.generate()
|
||||
config.headers['X-SQLBOT-KEY'] = request_key
|
||||
|
||||
@@ -266,8 +265,6 @@ class HttpService {
|
||||
heads['X-SQLBOT-ASSISTANT-ONLINE'] = assistantStore.getOnline
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const request_key = LicenseGenerator.generate()
|
||||
heads['X-SQLBOT-KEY'] = request_key
|
||||
|
||||
|
||||
@@ -51,8 +51,13 @@
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="name" :label="$t('user.name')" width="280" />
|
||||
<el-table-column prop="account" :label="$t('user.account')" width="280" />
|
||||
<el-table-column prop="name" show-overflow-tooltip :label="$t('user.name')" width="280" />
|
||||
<el-table-column
|
||||
prop="account"
|
||||
show-overflow-tooltip
|
||||
:label="$t('user.account')"
|
||||
width="280"
|
||||
/>
|
||||
<el-table-column prop="status" :label="$t('user.user_status')" width="180">
|
||||
<template #default="scope">
|
||||
<div class="user-status-container" :class="[scope.row.status ? 'active' : 'disabled']">
|
||||
|
||||
Reference in New Issue
Block a user