public override async Task <IActionResult> OnGetAsync()
        {
            await base.OnGetAsync();

            var name = _userClaimManager.GetDisplayName(User);

            // set defaults
            Message.Subject = $"Update Lesson Plan for {Entity.Title}";
            SenderName      = name;

            return(Page());
        }
示例#2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var createModel = new DiscussionCreateModel
            {
                TopicId      = Id,
                TenantId     = Tenant.Value.Id,
                DisplayName  = _userClaimManager.GetDisplayName(User),
                EmailAddress = _userClaimManager.GetUserName(User),
                MessageDate  = DateTimeOffset.UtcNow,
                Message      = Message
            };

            var userAgent = Request.ReadUserAgent();

            _mapper.Map(userAgent, createModel);

            var command = new EntityCreateCommand <DiscussionCreateModel, DiscussionReadModel>(User, createModel);
            var result  = await Mediator.Send(command);

            return(RedirectToPage("/topic/discussion/view", new { id = Id, tenant = TenantRoute }));
        }
        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 planLink = 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.LinkUrl        = planLink;
            email.LinkText       = "Edit Lesson Plan";

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

            ShowAlert("Successfully sent introduction email");

            return(RedirectToPage("/topic/planning/view", new { id = Id, tenant = TenantRoute }));
        }
示例#5
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());
        }