Exemple #1
0
        public async Task SendRegistrationAsync(string emailAddress, string subject, string message, int registrationId)
        {
            var registration = await _registrationService.GetWithUserAndEventInfoAndOrders(registrationId);

            var eventRegistration = new EventRegistration
            {
                ParticipantName = registration.ParticipantName,
                EventInfo       = registration.EventInfo,
                Orders          = registration.Orders,
                Email           = registration.User.Email,
                Verified        = (registration.Status != RegistrationStatus.Draft) ? true : false,
                HasOrder        = registration.Orders.Count > 0,
                Message         = message
            };

            eventRegistration.VerificationUrl = _urlHelper.Page(
                pageName: "/Events/Register/Confirm",
                pageHandler: null,
                values: new
            {
                id   = registration.RegistrationId,
                auth = registration.VerificationCode
            },
                protocol: _requestScheme
                );

            eventRegistration.EventUrl = _urlHelper.Page(
                pageName: "/Events/Details",
                pageHandler: null,
                values: new
            {
                id = registration.EventInfoId
            },
                protocol: _requestScheme
                );

            _logger.LogInformation(
                "RegistrationEmailSender: Sending registration email for registrationId {RegistrationId}",
                registrationId);

            await _applicationEmailSender
            .SendEmailWithTemplateAsync(Template, emailAddress, subject,
                                        eventRegistration);
        }
Exemple #2
0
        public async Task SendMagicLinkAsync(ApplicationUser user)
        {
            await _userManager.UpdateSecurityStampAsync(user);

            var token = await _userManager.GenerateUserTokenAsync(
                user : user,
                tokenProvider : "MagicLinkTokenProvider",
                purpose : "magic-link"
                );

            var magiclink = _urlHelper.Link(
                routeName: "MagicLinkRoute",
                values: new { userid = user.Id, token = token, });

            await _applicationEmailSender.SendEmailWithTemplateAsync(
                Template,
                user.Email,
                _stringLocalizer["Login link {0}", _siteConfig.Title],
                new MagicLinkVM
            {
                MagicLink = magiclink
            }
                );
        }