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); }