コード例 #1
0
        public async Task Handle(SendConfirmationEmailEvent notification, CancellationToken cancellationToken)
        {
            var confirmationToken = await _accountManager.GenerateEmailConfirmationTokenAsync(notification.Account);

            var encodedToken = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(confirmationToken));

            var confirmationLink = $"{_configuration.GetSection("BaseAPIUrl").Value}v1/user/email-confirmation?token={encodedToken}&id={notification.Account.Id}";

            await _queueService.Enqueue(new ConfirmationEmailDTO
            {
                EmailTemplate    = EmailTemplates.ConfirmationEmail,
                ConfirmationLink = HtmlEncoder.Default.Encode(confirmationLink),
                Email            = notification.Account.Email,
                UserName         = notification.Account.UserName
            }, cancellationToken);
        }