diff --git a/IRaCIS.Core.API/appsettings.CenterImageDev.json b/IRaCIS.Core.API/appsettings.CenterImageDev.json new file mode 100644 index 000000000..1262501aa --- /dev/null +++ b/IRaCIS.Core.API/appsettings.CenterImageDev.json @@ -0,0 +1,31 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "ConnectionStrings": { + "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=CenterImage_Test;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" + }, + "BasicSystemConfig": { + + "OpenUserComplexPassword": false, + + "OpenSignDocumentBeforeWork": false, + + "OpenTrialRelationDelete": true, + + "OpenLoginLimit": false + }, + + "SystemEmailSendConfig": { + "Port": 465, + "Host": "smtp.qiye.aliyun.com", + "FromEmail": "test@extimaging.com", + "FromName": "Test_IRC", + "AuthorizationCode": "SHzyyl2021" + } + +} diff --git a/IRaCIS.Core.API/appsettings.Development.json b/IRaCIS.Core.API/appsettings.Development.json index e9f58c77f..42058565c 100644 --- a/IRaCIS.Core.API/appsettings.Development.json +++ b/IRaCIS.Core.API/appsettings.Development.json @@ -19,7 +19,11 @@ "OpenTrialRelationDelete": true, - "OpenLoginLimit": false + "OpenLoginLimit": false, + + "LoginMaxFailCount": 3, + + "LoginFailLockMinutes":1 }, "SystemEmailSendConfig": { diff --git a/IRaCIS.Core.API/appsettings.Production.json b/IRaCIS.Core.API/appsettings.Production.json index 7daa550ea..f1e4a54f6 100644 --- a/IRaCIS.Core.API/appsettings.Production.json +++ b/IRaCIS.Core.API/appsettings.Production.json @@ -17,7 +17,10 @@ "OpenSignDocumentBeforeWork": true, - "OpenLoginLimit": true + "OpenLoginLimit": true, + "LoginMaxFailCount": 3, + + "LoginFailLockMinutes": 1 }, //"SystemEmailSendConfig": { // "Port": 465, diff --git a/IRaCIS.Core.API/appsettings.Staging.json b/IRaCIS.Core.API/appsettings.Staging.json index 79ee99b21..db61eee61 100644 --- a/IRaCIS.Core.API/appsettings.Staging.json +++ b/IRaCIS.Core.API/appsettings.Staging.json @@ -16,7 +16,10 @@ "OpenSignDocumentBeforeWork": true, - "OpenLoginLimit": true + "OpenLoginLimit": true, + "LoginMaxFailCount": 3, + + "LoginFailLockMinutes": 1 }, "SystemEmailSendConfig": { diff --git a/IRaCIS.Core.API/appsettings.USDemo.json b/IRaCIS.Core.API/appsettings.USDemo.json index 2f062f048..e6194ddc6 100644 --- a/IRaCIS.Core.API/appsettings.USDemo.json +++ b/IRaCIS.Core.API/appsettings.USDemo.json @@ -19,7 +19,11 @@ "OpenTrialRelationDelete": true, - "OpenLoginLimit": false + "OpenLoginLimit": false, + + "LoginMaxFailCount": 3, + + "LoginFailLockMinutes": 1 }, "SystemEmailSendConfig": { diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 8677beb20..2de18aeea 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -26,6 +26,8 @@ namespace IRaCIS.Application.Services private readonly IMemoryCache _cache; private readonly IOptionsMonitor _verifyConfig; + + public UserService(IRepository userRepository, IMailVerificationService mailVerificationService, @@ -617,8 +619,8 @@ namespace IRaCIS.Application.Services { const string cachePrefix = "login-failures:"; - const int maxFailures = 3; - const int lockoutMinutes = 1; + int maxFailures = _verifyConfig.CurrentValue.LoginMaxFailCount; + int lockoutMinutes = _verifyConfig.CurrentValue.LoginFailLockMinutes; // 生成缓存键 string cacheKey = $"{cachePrefix}{userName}"; @@ -637,7 +639,7 @@ namespace IRaCIS.Application.Services if (failCount >= maxFailures) { - throw new BusinessValidationFailedException($"密码连续错误3次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。"); + throw new BusinessValidationFailedException($"密码连续错误{maxFailures}次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。"); } var userLoginReturnModel = new LoginReturnDTO(); diff --git a/IRaCIS.Core.Domain/_Config/_AppSettings.cs b/IRaCIS.Core.Domain/_Config/_AppSettings.cs index a2d329b5f..4bda63fec 100644 --- a/IRaCIS.Core.Domain/_Config/_AppSettings.cs +++ b/IRaCIS.Core.Domain/_Config/_AppSettings.cs @@ -16,6 +16,11 @@ namespace IRaCIS.Core.Domain.Share public bool OpenTrialRelationDelete { get; set; } public bool OpenLoginLimit { get; set; } + + public int LoginMaxFailCount { get; set; } + + public int LoginFailLockMinutes { get; set; } + } public class SystemEmailSendConfig