From bafd8759d86ea102b03cc57d820c7c5e70ab8a0b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 25 May 2022 18:01:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Common/MailService.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index fdd6f2e4f..47fabd557 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -1,11 +1,11 @@ -using IRaCIS.Core.Infra.EFCore; -using IRaCIS.Core.Domain.Models; -using IRaCIS.Core.Domain.Share; -using MailKit.Security; +using IRaCIS.Core.Domain.Share; using MimeKit; using IRaCIS.Core.Application.Helper; using MailKit; using Microsoft.AspNetCore.Hosting; +using IRaCIS.Core.Application.Auth; +using AutoMapper; +using IRaCIS.Application.Contracts; namespace IRaCIS.Application.Services { @@ -31,13 +31,16 @@ namespace IRaCIS.Application.Services private readonly IRepository _systemBasicDatarepository; private readonly IWebHostEnvironment _hostEnvironment; - private readonly IRepository _userRepository; + private readonly ITokenService _tokenService; + + private readonly IMapper _mapper; + public MailVerificationService(IRepository verificationCodeRepository, IRepository systemBasicDatarepository, - IWebHostEnvironment hostEnvironment, IRepository userRepository) + IWebHostEnvironment hostEnvironment, IRepository userRepository, ITokenService tokenService, IMapper mapper) { _verificationCodeRepository = verificationCodeRepository; _systemBasicDatarepository = systemBasicDatarepository; @@ -258,6 +261,9 @@ namespace IRaCIS.Application.Services + Path.DirectorySeparatorChar.ToString() + "AdminAddUser.html"; + var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map(sysUserInfo))); + + routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&access_token=" + token; using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile)) { @@ -275,7 +281,7 @@ namespace IRaCIS.Application.Services messageToSend.Body = builder.ToMessageBody(); - + await SendEmailHelper.SendEmailAsync(messageToSend); }