Bug:Md5的模式无法登陆系统

Fix:执行SQL出错时,故定输入SQL语句的内容
This commit is contained in:
yzp 2024-11-27 09:53:20 +08:00
parent 1a97ca3ed8
commit bcbde150d9
2 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,4 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
@ -155,6 +155,15 @@ public class SysAuthService : IDynamicApiController, ITransient
{
if (CryptogramUtil.CryptoType == CryptogramEnum.MD5.ToString())
{
// 国密SM2解密前端密码传输SM2加密后的
try
{
password = CryptogramUtil.SM2Decrypt(password);
}
catch
{
throw Oops.Oh(ErrorCodeEnum.D0010);
}
if (user.Password.Equals(MD5Encryption.Encrypt(password))) return;
_sysCacheService.Set(keyPasswordErrorTimes, ++passwordErrorTimes, TimeSpan.FromMinutes(30));

View File

@ -1,4 +1,4 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
@ -127,6 +127,13 @@ public static class SqlSugarSetup
db.Ado.CommandTimeOut = 30;
// 打印SQL语句
db.Aop.OnError = ex =>
{
if (ex.Parametres == null) return;
var log = $"【{DateTime.Now}——错误SQL】\r\n{UtilMethods.GetNativeSql(ex.Sql, (SugarParameter[])ex.Parametres)}\r\n";
Log.Error(log, ex);
App.PrintToMiniProfiler("SqlSugar", "Error", log);
};
if (enableConsoleSql)
{
db.Aop.OnLogExecuting = (sql, pars) =>
@ -151,13 +158,6 @@ public static class SqlSugarSetup
Console.ForegroundColor = originColor;
App.PrintToMiniProfiler("SqlSugar", "Info", log);
};
db.Aop.OnError = ex =>
{
if (ex.Parametres == null) return;
var log = $"【{DateTime.Now}——错误SQL】\r\n{UtilMethods.GetNativeSql(ex.Sql, (SugarParameter[])ex.Parametres)}\r\n";
Log.Error(log, ex);
App.PrintToMiniProfiler("SqlSugar", "Error", log);
};
db.Aop.OnLogExecuted = (sql, pars) =>
{
//// 若参数值超过100个字符则进行截取