错误5次以上需要重新获取验证码
This commit is contained in:
@@ -279,7 +279,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
const { createApp, onMounted, watch, computed, ref } = Vue
|
const { createApp, onMounted, watch, computed, ref } = Vue
|
||||||
const { ElMessageBox, ElNotification, ElLoading } = ElementPlus;
|
const { ElMessageBox, ElNotification, ElLoading, ElMessage } = ElementPlus;
|
||||||
|
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
setup() {
|
setup() {
|
||||||
@@ -414,6 +414,11 @@
|
|||||||
},
|
},
|
||||||
verifyKey: async (pageData) => {
|
verifyKey: async (pageData) => {
|
||||||
if (pageData.loginForm?.phone?.length != 11 || pageData.loginForm?.code?.length != 4) {
|
if (pageData.loginForm?.phone?.length != 11 || pageData.loginForm?.code?.length != 4) {
|
||||||
|
//ElMessage.error('请将内容输入完整后再次点击登录!')
|
||||||
|
ElMessage({
|
||||||
|
message: '请将内容输入完整后再次点击登录!',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -355,6 +355,18 @@ namespace Vote.Services.ApiController
|
|||||||
var token = await HandlerLoginAsync(args);
|
var token = await HandlerLoginAsync(args);
|
||||||
return new { passed, token };
|
return new { passed, token };
|
||||||
}
|
}
|
||||||
|
//记录错误次数 错误5次以上需要重新获取验证码
|
||||||
|
var errorCount = _memoryCache.Get<int>("cache_code_error_count:" + args.phone);
|
||||||
|
if (errorCount >= 5)
|
||||||
|
{
|
||||||
|
await repSmsCode.Context.Updateable<nbzc_sms_code>().SetColumns(a => a.IsDeleted == true).Where(a => a.phone == args.phone).ExecuteCommandAsync();
|
||||||
|
_memoryCache.Remove("cache_code_error_count:" + args.phone);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errorCount++;
|
||||||
|
_memoryCache.Set<int>("cache_code_error_count:" + args.phone, errorCount);
|
||||||
|
}
|
||||||
return new { passed, token = "" };
|
return new { passed, token = "" };
|
||||||
}
|
}
|
||||||
private async Task<string> HandlerLoginAsync(VerifyLoginInput args)
|
private async Task<string> HandlerLoginAsync(VerifyLoginInput args)
|
||||||
|
|||||||
Reference in New Issue
Block a user