增加登录验证码设置

This commit is contained in:
2024-03-07 18:35:05 +08:00
parent 01dbb4461d
commit 653dffc14f
3 changed files with 27 additions and 1 deletions
@@ -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 = "";
@@ -35,6 +35,15 @@
<div class="form-group">
<input type="password" name="password" id="password" class="form-control" placeholder="密码" required="">
</div>
@if (Utils.GetSetting("SystemSetting:AdminLoginWithCode") == "1")
{
<div class="form-group input-group">
<input type="text" name="code" id="code" class="form-control" placeholder="验证码" required="">
<span class="input-group-addon" style="padding:0px;">
<img src="~/VerifyCode/MixVerifyCode" onclick="this.src='/VerifyCode/MixVerifyCode?'+Math.random()" style="cursor:pointer;" />
</span>
</div>
}
<button type="submit" class="btn btn-primary block full-width m-b">登 录</button>
<p class="text-muted text-center">
COMCMS © 2014-@DateTime.Now.Year
+2 -1
View File
@@ -12,7 +12,8 @@
"COMCMSPrefixKey": "abc_",
"SignSalt": "comcms",
"JwtSecret": "comcms0b311362786dabe03af7b484ed032b91698a4eb9377687bd031d837082",
"PasswordStrength": 0
"PasswordStrength": 0,
"AdminLoginWithCode": "1"
},
"connectionStrings": {
"dbconn": {