コード例 #1
0
        public void Process(DeferredRegistrationArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNullOrEmpty(args.EncryptedToken, "args.EncryptedToken");
            Assert.ArgumentNotNullOrEmpty(args.UserData.FirstName, "args.UserData.FirstName");
            Assert.ArgumentNotNullOrEmpty(args.UserData.LastName, "args.UserData.LastName");
            Assert.ArgumentNotNull(args.MailMessage, "args.MailMessage");
            Assert.ArgumentNotNullOrEmpty(args.MailMessage.Body, "args.MailMessage.Body");

            var processActivationLinkPageId = Settings.GetSetting("DeferredRegistration.PageToProcessActivationLink");

            Assert.ArgumentNotNullOrEmpty(processActivationLinkPageId, "processActivationLinkPageId");

            var processActivationLinkPageItem = Sitecore.Context.Database.GetItem(processActivationLinkPageId);

            Assert.ArgumentNotNull(processActivationLinkPageItem, "processActivationLinkPageItem");

            var urlOptions = new UrlOptions
            {
                AlwaysIncludeServerUrl = true,
                LanguageEmbedding      = LanguageEmbedding.Never
            };
            var deferredRegistrationPageUrl = LinkManager.GetItemUrl(processActivationLinkPageItem, urlOptions);

            var activationLink = WebUtil.AddQueryString(deferredRegistrationPageUrl, "hash", args.EncryptedToken);

            args.MailMessage.Body = args.MailMessage.Body.Replace("{activation-link}", activationLink);
            args.MailMessage.Body = args.MailMessage.Body.Replace("{name}", args.UserData.FirstName);
        }
コード例 #2
0
        public void Process(DeferredRegistrationArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNull(args.MailMessage, "args.MailMessage");

            MainUtil.SendMail(args.MailMessage);
        }
コード例 #3
0
        public void Process(DeferredRegistrationArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNull(args.UserData, "args.UserData");
            Assert.ArgumentNotNullOrEmpty(args.UserData.UserName, "args.UserData.UserName");

            args.EncryptedToken = cipher.Encrypt(args.UserData.UserName);
        }
コード例 #4
0
        public void Process(DeferredRegistrationArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNullOrEmpty(deferredRegistrationDomain, "deferredRegistration");
            Assert.ArgumentNotNullOrEmpty(args.UserData.FirstName, "args.UserData.FirstName");
            Assert.ArgumentNotNullOrEmpty(args.UserData.LastName, "args.UserData.LastName");

            args.UserData.UserName = $@"{deferredRegistrationDomain}\{args.UserData.FirstName}{args.UserData.LastName}{Guid.NewGuid()}";
        }
コード例 #5
0
        public void Process(DeferredRegistrationArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNull(args.EmailItem, "args.EmailItem");
            Assert.ArgumentNotNullOrEmpty(args.UserData.EmailAddress, "args.UserData.EmailAddress");

            args.MailMessage = new MailMessage(args.EmailItem["From"], args.UserData.EmailAddress, args.EmailItem["Subject"], args.EmailItem["Body"])
            {
                IsBodyHtml = true
            };
        }
コード例 #6
0
        public void Process(DeferredRegistrationArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNullOrEmpty(DefaultActivationFlowEmailItemId, "DefaultActivationFlowEmailItemId");

            var emailItem = Sitecore.Context.Database.GetItem(DefaultActivationFlowEmailItemId);

            Assert.ArgumentNotNull(emailItem, "emailItem");

            args.EmailItem = emailItem;
        }
コード例 #7
0
        public void Process(DeferredRegistrationArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNull(args.UserData, "args.UserData");
            Assert.ArgumentNotNullOrEmpty(args.UserData.FirstName, "args.UserData.FirstName");
            Assert.ArgumentNotNullOrEmpty(args.UserData.LastName, "args.UserData.LastName");
            Assert.ArgumentNotNullOrEmpty(ProfileItemId, "ProfileItemId");

            if (User.Exists(args.UserData.UserName))
            {
                args.AbortPipeline();
                return;
            }

            CreateUser(args.UserData);
        }
コード例 #8
0
        public void Process(DeferredRegistrationArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            var thankYouPageId = Settings.GetSetting("DeferredRegistration.ThankYouPage");

            Assert.ArgumentNotNullOrEmpty(thankYouPageId, "thankYouPageId");

            var thankYouPageItem = Sitecore.Context.Database.GetItem(thankYouPageId);

            Assert.ArgumentNotNull(thankYouPageItem, "thankYouPageItem");

            var thankYouPageUrl = LinkManager.GetItemUrl(thankYouPageItem);

            WebUtil.Redirect(thankYouPageUrl);
        }