修改邮箱配置校验

This commit is contained in:
2025-07-21 14:23:09 +08:00
parent bae6f099fe
commit f2836a8928
6 changed files with 9 additions and 4 deletions
@@ -128,7 +128,7 @@ namespace IRaCIS.Core.Application.Service
{
//检查手机或者邮箱是否有效
if (!Regex.IsMatch(email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"))
if (!Regex.IsMatch(email, _systemEmailConfig.EmailRegexStr))
{
//---Please input a legal email
return ResponseOutput.NotOk(_localizer["User_LegalEmail"]);
@@ -325,7 +325,7 @@ namespace IRaCIS.Core.Application.Service
{
//检查手机或者邮箱是否有效
if (!Regex.IsMatch(email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"))
if (!Regex.IsMatch(email, _systemEmailConfig.EmailRegexStr))
{
//---请输入一个正确的邮箱。
@@ -5,6 +5,7 @@ using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System.Text.RegularExpressions;
namespace IRaCIS.Core.Application.Service
@@ -24,7 +25,7 @@ namespace IRaCIS.Core.Application.Service
IRepository<TrialExperience> _trialExperienceRepository,
IRepository<Dictionary> _dictionaryRepository,
IOptionsMonitor<SystemEmailSendConfig> _systemEmailConfig,
IRepository<TrialExperienceCriteria> _trialExperienceCriteriaRepository,
IMailVerificationService _mailVerificationService, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IEnrollService
{
@@ -385,7 +386,7 @@ namespace IRaCIS.Core.Application.Service
.Select(t => new { t.EMail, t.FirstName, t.LastName }).ToListAsync();
var errorList = emaiList.Where(t => !Regex.IsMatch(t.EMail, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"))
var errorList = emaiList.Where(t => !Regex.IsMatch(t.EMail, _systemEmailConfig.CurrentValue.EmailRegexStr))
.ToList();
if (errorList.Count() > 0)