diff --git a/Framework/YLErp.Core/Configuration/Abstract/IErpConfig.cs b/Framework/YLErp.Core/Configuration/Abstract/IErpConfig.cs index 1d6ec6c9..007e2eeb 100644 --- a/Framework/YLErp.Core/Configuration/Abstract/IErpConfig.cs +++ b/Framework/YLErp.Core/Configuration/Abstract/IErpConfig.cs @@ -1,4 +1,4 @@ -using YLErp.Configuration.Enums; +using YLErp.Configuration.Enums; using static YLErp.DBModels.Consts.ConsReport; namespace YLErp.Configuration @@ -474,6 +474,11 @@ namespace YLErp.Configuration /// bool StrictAuthorize { get; } + /// + /// 禁用账号密码登录(仅允许SSO) + /// + bool DisablePasswordLogin { get; } + /// /// 风险对冲累积总盈亏是否统计已过期的场内交易 /// diff --git a/Framework/YLErp.Core/Configuration/ProjectSettings.cs b/Framework/YLErp.Core/Configuration/ProjectSettings.cs index c1b95b49..2aeaaffa 100644 --- a/Framework/YLErp.Core/Configuration/ProjectSettings.cs +++ b/Framework/YLErp.Core/Configuration/ProjectSettings.cs @@ -541,6 +541,8 @@ namespace YLErp /// public bool StrictAuthorize { get; set; } + public bool DisablePasswordLogin { get; set; } + /// /// 风险对冲累积总盈亏是否统计已过期的场内交易 /// diff --git a/YLErpDAL/Modules/AppModule/AppUpgrader.cs b/YLErpDAL/Modules/AppModule/AppUpgrader.cs index b6fea8ad..4a35b61f 100644 --- a/YLErpDAL/Modules/AppModule/AppUpgrader.cs +++ b/YLErpDAL/Modules/AppModule/AppUpgrader.cs @@ -1,4 +1,4 @@ -using System.Xml.Linq; +using System.Xml.Linq; namespace YLErp.Modules.AppModule { @@ -217,6 +217,8 @@ namespace YLErp.Modules.AppModule data = configService.RemoveData("ProjectConfig", "StrictAuthorize"); configService.AddDataIfNotExists("ProjectConfig", "Erp.StrictAuthorize", data?.PValue ?? "false", "bool", "严格的权限验证"); + configService.AddDataIfNotExists("ProjectConfig", "Erp.DisablePasswordLogin", "false", "bool", "禁用账号密码登录,仅允许SSO"); + configService.AddDataIfNotExists("ProjectConfig", "Erp.RiskAccPnl_SumExpiredExchangeTrades", data?.PValue ?? "false", "bool", "风险对冲累积总盈亏是否统计已过期的场内交易"); //----------------------------------------------- diff --git a/YLErpDAL/Resources/appconfig.xml b/YLErpDAL/Resources/appconfig.xml index d82f1af9..0633d249 100644 --- a/YLErpDAL/Resources/appconfig.xml +++ b/YLErpDAL/Resources/appconfig.xml @@ -52,5 +52,7 @@ + + diff --git a/YLErpWeb/Controllers/AccountController.cs b/YLErpWeb/Controllers/AccountController.cs index 74b3da42..9f83badb 100644 --- a/YLErpWeb/Controllers/AccountController.cs +++ b/YLErpWeb/Controllers/AccountController.cs @@ -44,11 +44,21 @@ namespace YLErp.Web.Controllers } } - if (!skipSso && SsoLoginConfig.SSO_Enable && PS.Config.Company == CompanyEnum.天风) + if (SsoLoginConfig.SSO_Enable && PS.Config.Company == CompanyEnum.天风) { return View("TianFengLogin"); } + if (PS.Config.ErpElement.DisablePasswordLogin) + { + var ssoUrl = YLErp.Web.Models.GeneralSSOConfig.AuthUrl; + if (!string.IsNullOrEmpty(ssoUrl)) + { + return Redirect(ssoUrl); + } + return Content("SSO登录未配置,请联系管理员"); + } + return LoginError(null); }