diff --git a/COMCMS.Web/Areas/AdminCP/Controllers/LoginController.cs b/COMCMS.Web/Areas/AdminCP/Controllers/LoginController.cs index b3e7a65..2acaf81 100644 --- a/COMCMS.Web/Areas/AdminCP/Controllers/LoginController.cs +++ b/COMCMS.Web/Areas/AdminCP/Controllers/LoginController.cs @@ -50,6 +50,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers { string strUserName = Request.Form["username"]; string strPassWord = Request.Form["password"]; + string code = Request.Form["code"]; if (strUserName.Length % 8 != 0) { @@ -69,6 +70,21 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers tip.Other = "reload"; return Json(tip); } + + if (Utils.GetSetting("SystemSetting:AdminLoginWithCode") == "1") + { + if (string.IsNullOrEmpty(code)) + { + tip.Message = "请输入验证码!"; + return Json(tip); + } + if (!VerifyCodeHelper.GetSingleObj().VerifyCodeIsOK(code)) + { + tip.Message = "验证码错误!"; + return Json(tip); + } + } + //解密 string username = ""; string password = ""; diff --git a/COMCMS.Web/Areas/AdminCP/Views/Login/Index.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Login/Index.cshtml index bb3d415..f16d4eb 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Login/Index.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Login/Index.cshtml @@ -35,6 +35,15 @@
+ @if (Utils.GetSetting("SystemSetting:AdminLoginWithCode") == "1") + { +
+ + + + +
+ }

COMCMS © 2014-@DateTime.Now.Year diff --git a/COMCMS.Web/appsettings.json b/COMCMS.Web/appsettings.json index 20e86b3..cd516bc 100644 --- a/COMCMS.Web/appsettings.json +++ b/COMCMS.Web/appsettings.json @@ -12,7 +12,8 @@ "COMCMSPrefixKey": "abc_", "SignSalt": "comcms", "JwtSecret": "comcms0b311362786dabe03af7b484ed032b91698a4eb9377687bd031d837082", - "PasswordStrength": 0 + "PasswordStrength": 0, + "AdminLoginWithCode": "1" }, "connectionStrings": { "dbconn": {