private async Task SendInvite(UserInviteModel inviteModel, User recipientUser, IPrincipal principal, string link)
        {
            var name  = _userClaimManager.GetDisplayName(principal);
            var email = _userClaimManager.GetEmail(principal);

            var inviteEmail = new UserInviteEmail
            {
                TenantName = _userClaimManager.GetTenantName(principal),

                SenderName  = name,
                SenderEmail = email,

                ReplyToName    = name,
                ReplyToAddress = email,

                RecipientName    = recipientUser.DisplayName,
                RecipientAddress = recipientUser.Email,

                Link = link,

                UserAgent       = inviteModel.UserAgent,
                Browser         = inviteModel.Browser,
                OperatingSystem = inviteModel.OperatingSystem,
                DeviceFamily    = inviteModel.DeviceFamily,
                DeviceBrand     = inviteModel.DeviceBrand,
                DeviceModel     = inviteModel.DeviceModel,
                IpAddress       = inviteModel.IpAddress
            };

            Logger.LogInformation("Sending user invite email to '{recipient}'", recipientUser.Email);

            await EmailTemplate.SendUserInviteEmail(inviteEmail);
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var address = _userClaimManager.GetEmail(User) ?? User.Identity.Name;
            var name    = _userClaimManager.GetDisplayName(User);

            var link = Url.Page(
                "/topic/planning/view",
                pageHandler: null,
                values: new { id = Id, tenant = TenantRoute },
                protocol: Request.Scheme);

            var email = Message;

            email.ReplyToAddress = address;
            email.ReplyToName    = name;
            email.LinkText       = "Update Lesson Plan";
            email.LinkUrl        = link;

            var command = new SendUserLinkEmailCommand(User, email);
            await Mediator.Send(command);

            ShowAlert("Successfully sent email");

            return(RedirectToPage("/topic/planning/view", new { id = Id, tenant = TenantRoute }));
        }
Beispiel #3
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (Tenant == null || !Tenant.HasValue)
            {
                return(RedirectToPage("/Index"));
            }

            var address = _userClaimManager.GetEmail(User) ?? User.Identity.Name;
            var name    = _userClaimManager.GetDisplayName(User);

            Message = new SummaryReportModel();
            Message.ReplyToAddress = address;
            Message.ReplyToName    = name;

            await Load();
            await LoadMembers();

            return(Page());
        }