验证码修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
633507d4cd
commit
fd9af47606
|
@ -190,7 +190,7 @@ namespace IRaCIS.Application.Services
|
||||||
messageToSend = await GetEmailSubejctAndHtmlInfoAndBuildAsync(mfaType == UserMFAType.Login ? EmailBusinessScenario.MFALogin : EmailBusinessScenario.MFAUnlock, messageToSend, emailConfigFunc);
|
messageToSend = await GetEmailSubejctAndHtmlInfoAndBuildAsync(mfaType == UserMFAType.Login ? EmailBusinessScenario.MFALogin : EmailBusinessScenario.MFAUnlock, messageToSend, emailConfigFunc);
|
||||||
|
|
||||||
|
|
||||||
var sucessHandle = GetEmailSuccessHandle(userId, verificationCode);
|
var sucessHandle = GetEmailSuccessHandle(userId, verificationCode, emailAddress);
|
||||||
|
|
||||||
|
|
||||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||||
|
@ -229,7 +229,7 @@ namespace IRaCIS.Application.Services
|
||||||
messageToSend = await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UserResetEmail, messageToSend, emailConfigFunc);
|
messageToSend = await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UserResetEmail, messageToSend, emailConfigFunc);
|
||||||
|
|
||||||
|
|
||||||
var sucessHandle = GetEmailSuccessHandle(userId, verificationCode);
|
var sucessHandle = GetEmailSuccessHandle(userId, verificationCode, emailAddress);
|
||||||
|
|
||||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ namespace IRaCIS.Application.Services
|
||||||
messageToSend = await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UnloginUseEmailResetPassword, messageToSend, emailConfigFunc);
|
messageToSend = await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UnloginUseEmailResetPassword, messageToSend, emailConfigFunc);
|
||||||
|
|
||||||
////此时不知道用户
|
////此时不知道用户
|
||||||
var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode);
|
var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode, emailAddress);
|
||||||
|
|
||||||
|
|
||||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||||
|
@ -355,7 +355,7 @@ namespace IRaCIS.Application.Services
|
||||||
messageToSend = await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SiteSurveyLogin, messageToSend, emailConfigFunc);
|
messageToSend = await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SiteSurveyLogin, messageToSend, emailConfigFunc);
|
||||||
|
|
||||||
//此时不知道用户
|
//此时不知道用户
|
||||||
var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode);
|
var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode, emailAddress);
|
||||||
|
|
||||||
|
|
||||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||||
|
|
|
@ -208,6 +208,11 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.NotOk(_localizer["User_VerificationCodeExpired"]);
|
return ResponseOutput.NotOk(_localizer["User_VerificationCodeExpired"]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (verificationRecord.EmailOrPhone.Trim() != newEmail.Trim())
|
||||||
|
{
|
||||||
|
//发送验证嘛的和提交的邮箱不一致
|
||||||
|
return ResponseOutput.NotOk(_localizer["User_VerificationEmailNotSameWithBefore"]);
|
||||||
|
}
|
||||||
else //验证码正确 并且 没有超时
|
else //验证码正确 并且 没有超时
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -684,7 +689,7 @@ namespace IRaCIS.Application.Services
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<IResponseOutput> VerifyMFACodeAsync(Guid userId, string Code)
|
public async Task<IResponseOutput> VerifyMFACodeAsync(Guid userId, string Code)
|
||||||
{
|
{
|
||||||
var verificationRecord = await _repository.GetQueryable<VerificationCode>().OrderByDescending(x => x.ExpirationTime).Where(t => t.UserId == userId && t.Code == Code && t.CodeType == VerifyType.Email).FirstOrDefaultAsync();
|
var verificationRecord = await _verificationCodeRepository.Where(t => t.UserId == userId && t.Code == Code && t.CodeType == VerifyType.Email).OrderByDescending(x => x.ExpirationTime).FirstOrDefaultAsync();
|
||||||
VerifyEmialGetDoctorInfoOutDto result = new VerifyEmialGetDoctorInfoOutDto();
|
VerifyEmialGetDoctorInfoOutDto result = new VerifyEmialGetDoctorInfoOutDto();
|
||||||
|
|
||||||
//检查数据库是否存在该验证码
|
//检查数据库是否存在该验证码
|
||||||
|
@ -707,6 +712,10 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
else //验证码正确 并且 没有超时
|
else //验证码正确 并且 没有超时
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
//删除验证码历史记录
|
||||||
|
await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.Id == verificationRecord.Id);
|
||||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, OptType = UserOptType.MFALogin }, true);
|
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, OptType = UserOptType.MFALogin }, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,10 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
else //验证码正确 并且 没有超时
|
else //验证码正确 并且 没有超时
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//删除验证码历史记录
|
||||||
|
await _repository.BatchDeleteAsync<VerificationCode>(t => t.Id == verificationRecord.Id);
|
||||||
|
|
||||||
var dockerInfo = await _repository.Where<Doctor>(t => t.EMail == inDto.EmailOrPhone || t.Phone == inDto.EmailOrPhone).FirstOrDefaultAsync();
|
var dockerInfo = await _repository.Where<Doctor>(t => t.EMail == inDto.EmailOrPhone || t.Phone == inDto.EmailOrPhone).FirstOrDefaultAsync();
|
||||||
|
|
||||||
if (dockerInfo != null)
|
if (dockerInfo != null)
|
||||||
|
@ -192,6 +196,9 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//删除验证码历史记录
|
||||||
|
await _repository.BatchDeleteAsync<VerificationCode>(t => t.Id == verifyRecord.Id);
|
||||||
|
|
||||||
//验证码正确 不处理
|
//验证码正确 不处理
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue