fix(security): 清理测试脚本硬编码数据库密码与后台默认演示凭证预填
这个提交包含在:
@@ -81,9 +81,9 @@
|
||||
const userStore = useUserStore();
|
||||
|
||||
const loginConfig = useStorage('login-config', {
|
||||
rememberPassword: true,
|
||||
username: 'admin', // 演示默认值
|
||||
password: 'admin', // demo default value
|
||||
rememberPassword: false,
|
||||
username: '',
|
||||
password: '',
|
||||
});
|
||||
const userInfo = reactive({
|
||||
username: loginConfig.value.username,
|
||||
|
||||
@@ -4,8 +4,8 @@ export default {
|
||||
'login.form.password.errMsg': 'Password cannot be empty',
|
||||
'login.form.login.errMsg': 'Login error, refresh and try again',
|
||||
'login.form.login.success': 'welcome to use',
|
||||
'login.form.userName.placeholder': 'Username: admin',
|
||||
'login.form.password.placeholder': 'Password: admin',
|
||||
'login.form.userName.placeholder': 'Username',
|
||||
'login.form.password.placeholder': 'Password',
|
||||
'login.form.rememberPassword': 'Remember password',
|
||||
'login.form.forgetPassword': 'Forgot password',
|
||||
'login.form.login': 'login',
|
||||
|
||||
@@ -4,8 +4,8 @@ export default {
|
||||
'login.form.password.errMsg': '密码不能为空',
|
||||
'login.form.login.errMsg': '登录出错,轻刷新重试',
|
||||
'login.form.login.success': '欢迎使用',
|
||||
'login.form.userName.placeholder': '用户名:admin',
|
||||
'login.form.password.placeholder': '密码:admin',
|
||||
'login.form.userName.placeholder': '请输入管理员用户名',
|
||||
'login.form.password.placeholder': '请输入管理员密码',
|
||||
'login.form.rememberPassword': '记住密码',
|
||||
'login.form.forgetPassword': '忘记密码',
|
||||
'login.form.login': '登录',
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import 'dotenv/config';
|
||||
import mysql from 'mysql2/promise';
|
||||
|
||||
async function testConnection() {
|
||||
const host = '118.184.172.94';
|
||||
const port = 3306;
|
||||
const user = 'peiwan';
|
||||
const password = 'XxW7Xe5rRSckKmXm';
|
||||
const database = 'peiwan';
|
||||
const host = process.env.MYSQL_HOST || '127.0.0.1';
|
||||
const port = Number(process.env.MYSQL_PORT) || 3306;
|
||||
const user = process.env.MYSQL_USER || 'peiwan';
|
||||
const password = process.env.MYSQL_PASSWORD || '';
|
||||
const database = process.env.MYSQL_DATABASE || 'peiwan';
|
||||
|
||||
console.log(`[Remote Test] 尝试连接远程 MySQL: ${host}:${port}, 用户: ${user}, 库: ${database}`);
|
||||
console.log(`[Remote Test] 尝试连接 MySQL: ${host}:${port}, 用户: ${user}, 库: ${database}`);
|
||||
|
||||
try {
|
||||
const connection = await mysql.createConnection({
|
||||
@@ -19,10 +20,9 @@ async function testConnection() {
|
||||
connectTimeout: 5000,
|
||||
});
|
||||
|
||||
console.log('[Remote Test] 恭喜,成功连接到线上远程数据库!');
|
||||
console.log('[Remote Test] 成功连接数据库');
|
||||
const [rows]: any = await connection.query('SHOW TABLES;');
|
||||
console.log('[Remote Test] 线上已存在的表数量:', rows.length);
|
||||
console.log('[Remote Test] 表列表:', rows.map((r: any) => Object.values(r)[0]).join(', '));
|
||||
console.log('[Remote Test] 表数量:', rows.length);
|
||||
await connection.end();
|
||||
return true;
|
||||
} catch (err: any) {
|
||||
@@ -31,4 +31,6 @@ async function testConnection() {
|
||||
}
|
||||
}
|
||||
|
||||
testConnection();
|
||||
if (process.env.RUN_DB_TEST === 'true') {
|
||||
void testConnection();
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户