From 5301b9f103e45cd8f1451cd78448377efabcc452 Mon Sep 17 00:00:00 2001 From: "GukSang.Jin" Date: Tue, 27 Jan 2026 09:29:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 全自动水压检测仪/DATA/DatabaseInitializer.cs | 10 +++++----- 全自动水压检测仪/DATA/LoginDebugHelper.cs | 8 ++++---- 全自动水压检测仪/Program.cs | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/全自动水压检测仪/DATA/DatabaseInitializer.cs b/全自动水压检测仪/DATA/DatabaseInitializer.cs index 0910757..c792123 100644 --- a/全自动水压检测仪/DATA/DatabaseInitializer.cs +++ b/全自动水压检测仪/DATA/DatabaseInitializer.cs @@ -41,12 +41,12 @@ namespace 全自动水压检测仪.DATA try { // 删除现有的默认用户 - connection.Execute("DELETE FROM sys_users WHERE username IN ('admin', 'cgx')"); + connection.Execute("DELETE FROM sys_users WHERE username IN ('admin', 'csi')"); Debug.WriteLine("已删除现有默认用户"); // 重新创建 CreateUserIfNotExists(connection, "admin", "admin123", 1); - CreateUserIfNotExists(connection, "cgx", "123", 0); + CreateUserIfNotExists(connection, "csi", "123456", 0); Debug.WriteLine("默认用户重置完成!"); } @@ -119,9 +119,9 @@ namespace 全自动水压检测仪.DATA // 创建默认管理员账户 admin / admin123 CreateUserIfNotExists(connection, "admin", "admin123", 1); - - // 创建默认普通用户账户 cgx / 123 - CreateUserIfNotExists(connection, "cgx", "123", 0); + + // 创建默认普通用户账户 csi / 123456 + CreateUserIfNotExists(connection, "csi", "123456", 0); } catch (Exception ex) { diff --git a/全自动水压检测仪/DATA/LoginDebugHelper.cs b/全自动水压检测仪/DATA/LoginDebugHelper.cs index 8ed3ed2..6bce43f 100644 --- a/全自动水压检测仪/DATA/LoginDebugHelper.cs +++ b/全自动水压检测仪/DATA/LoginDebugHelper.cs @@ -87,7 +87,7 @@ namespace 全自动水压检测仪.DATA connection.Open(); // 删除现有用户 - connection.Execute("DELETE FROM sys_users WHERE username IN ('admin', 'cgx')"); + connection.Execute("DELETE FROM sys_users WHERE username IN ('admin', 'csi')"); Debug.WriteLine("已删除现有默认用户"); // 重新创建 admin @@ -101,12 +101,12 @@ namespace 全自动水压检测仪.DATA // 重新创建 cgx string salt2 = PasswordHelper.GenerateSalt(); - string hash2 = PasswordHelper.HashPassword("123", salt2); + string hash2 = PasswordHelper.HashPassword("123456", salt2); connection.Execute(@" INSERT INTO sys_users (username, password_hash, salt, user_role, status, create_time) VALUES (@username, @hash, @salt, @role, 1, NOW())", - new { username = "cgx", hash = hash2, salt = salt2, role = 0 }); - Debug.WriteLine("✓ 创建普通用户: cgx / 123"); + new { username = "csi", hash = hash2, salt = salt2, role = 0 }); + Debug.WriteLine("✓ 创建普通用户: csi / 123456"); Debug.WriteLine("默认用户重置完成!"); } diff --git a/全自动水压检测仪/Program.cs b/全自动水压检测仪/Program.cs index 063cbc2..b64b38e 100644 --- a/全自动水压检测仪/Program.cs +++ b/全自动水压检测仪/Program.cs @@ -35,7 +35,7 @@ namespace 全自动水压检测仪 if (forceReset) { var result = MessageBox.Show( - "确定要重置默认用户吗?\n\n这将删除并重新创建:\n• admin / admin123 (管理员)\n• cgx / 123 (普通用户)\n\n其他用户不受影响。", + "确定要重置默认用户吗?\n\n这将删除并重新创建:\n• admin / admin123 (管理员)\n• csi / 123456 (普通用户)\n\n其他用户不受影响。", "重置默认用户", MessageBoxButtons.YesNo, MessageBoxIcon.Question); @@ -44,7 +44,7 @@ namespace 全自动水压检测仪 { DatabaseInitializer.Initialize(); DatabaseInitializer.ForceResetDefaultUsers(); - MessageBox.Show("默认用户已重置!\n\n管理员: admin / admin123\n普通用户: cgx / 123", + MessageBox.Show("默认用户已重置!\n\n管理员: admin / admin123\n普通用户: csi / 123456", "重置成功", MessageBoxButtons.OK, MessageBoxIcon.Information); } return; @@ -101,7 +101,7 @@ namespace 全自动水压检测仪 // 检查默认用户 var adminUser = userRepo.GetUserByUsername("admin"); - var cgxUser = userRepo.GetUserByUsername("cgx"); + var csiUser = userRepo.GetUserByUsername("csi"); bool needsReset = false; @@ -144,11 +144,11 @@ namespace 全自动水压检测仪 } // 检查 cgx 用户 - if (cgxUser != null) + if (csiUser != null) { - string storedPassword = cgxUser.PasswordHash ?? ""; + string storedPassword = csiUser.PasswordHash ?? ""; - System.Diagnostics.Debug.WriteLine($"\n检查 cgx 用户:"); + System.Diagnostics.Debug.WriteLine($"\n检查 csi 用户:"); System.Diagnostics.Debug.WriteLine($" 当前密码值: '{storedPassword}'"); System.Diagnostics.Debug.WriteLine($" 密码长度: {storedPassword.Length}"); @@ -174,7 +174,7 @@ namespace 全自动水压检测仪 } else { - System.Diagnostics.Debug.WriteLine($"\ncgx 用户不存在"); + System.Diagnostics.Debug.WriteLine($"\ncsi 用户不存在"); needsReset = true; } @@ -184,7 +184,7 @@ namespace 全自动水压检测仪 DatabaseInitializer.ForceResetDefaultUsers(); System.Diagnostics.Debug.WriteLine("密码数据已修复!"); System.Diagnostics.Debug.WriteLine(" admin 密码: admin123"); - System.Diagnostics.Debug.WriteLine(" cgx 密码: 123"); + System.Diagnostics.Debug.WriteLine(" csi 密码: 123456"); } else {