Ejemplo n.º 1
0
        private void DisplayConfirmation(int personId)
        {
            PersonService personService = new PersonService();
            Person        person        = personService.Get(personId);

            if (person != null)
            {
                Rock.Model.UserLogin user = CreateUser(person, false);

                var mergeObjects = new Dictionary <string, object>();
                mergeObjects.Add("ConfirmAccountUrl", RootPath + "ConfirmAccount");

                var personDictionary = person.ToDictionary();
                mergeObjects.Add("Person", personDictionary);

                mergeObjects.Add("User", user.ToDictionary());

                var recipients = new Dictionary <string, Dictionary <string, object> >();
                recipients.Add(person.Email, mergeObjects);

                Email email = new Email(Rock.SystemGuid.EmailTemplate.SECURITY_CONFIRM_ACCOUNT);
                email.Send(recipients);

                ShowPanel(4);
            }
            else
            {
                ShowErrorMessage("Invalid Person");
            }
        }
Ejemplo n.º 2
0
        private void DisplayConfirmation(int personId)
        {
            PersonService personService = new PersonService();
            Person        person        = personService.Get(personId);

            if (person != null)
            {
                Rock.Model.UserLogin user = CreateUser(person, false);

                string url = LinkedPageUrl("ConfirmationPage");
                if (string.IsNullOrWhiteSpace(url))
                {
                    url = ResolveRockUrl("~/ConfirmAccount");
                }
                var mergeObjects = new Dictionary <string, object>();
                mergeObjects.Add("ConfirmAccountUrl", RootPath + url.TrimStart(new char[] { '/' }));

                var personDictionary = person.ToDictionary();
                mergeObjects.Add("Person", personDictionary);

                mergeObjects.Add("User", user.ToDictionary());

                var recipients = new Dictionary <string, Dictionary <string, object> >();
                recipients.Add(person.Email, mergeObjects);

                Email email = new Email(GetAttributeValue("ConfirmAccountTemplate"));
                email.Send(recipients);

                ShowPanel(4);
            }
            else
            {
                ShowErrorMessage("Invalid Person");
            }
        }
Ejemplo n.º 3
0
        private void DisplaySuccess(Rock.Model.UserLogin user)
        {
            FormsAuthentication.SignOut();
            Rock.Security.Authorization.SetAuthCookie(tbUserName.Text, false, false);

            if (user != null && user.PersonId.HasValue)
            {
                PersonService personService = new PersonService();
                Person        person        = personService.Get(user.PersonId.Value);

                if (person != null)
                {
                    string url = LinkedPageUrl("ConfirmationPage");
                    if (string.IsNullOrWhiteSpace(url))
                    {
                        url = ResolveRockUrl("~/ConfirmAccount");
                    }
                    var mergeObjects = new Dictionary <string, object>();
                    mergeObjects.Add("ConfirmAccountUrl", RootPath + url.TrimStart(new char[] { '/' }));

                    var personDictionary = person.ToDictionary();
                    mergeObjects.Add("Person", personDictionary);

                    mergeObjects.Add("User", user.ToDictionary());

                    var recipients = new Dictionary <string, Dictionary <string, object> >();
                    recipients.Add(person.Email, mergeObjects);

                    Email email = new Email(GetAttributeValue("AccountCreatedTemplate"));
                    email.Send(recipients);

                    lSuccessCaption.Text = GetAttributeValue("SuccessCaption");
                    if (lSuccessCaption.Text.Contains("{0}"))
                    {
                        lSuccessCaption.Text = string.Format(lSuccessCaption.Text, person.FirstName);
                    }

                    ShowPanel(5);
                }
                else
                {
                    ShowErrorMessage("Invalid Person");
                }
            }
            else
            {
                ShowErrorMessage("Invalid User");
            }
        }
Ejemplo n.º 4
0
        private void DisplaySuccess(Rock.Model.UserLogin user)
        {
            FormsAuthentication.SignOut();
            Rock.Security.Authorization.SetAuthCookie(tbUserName.Text, false, false);

            if (user != null && user.PersonId.HasValue)
            {
                PersonService personService = new PersonService();
                Person        person        = personService.Get(user.PersonId.Value);

                if (person != null)
                {
                    var mergeObjects = new Dictionary <string, object>();
                    mergeObjects.Add("ConfirmAccountUrl", RootPath + "ConfirmAccount");

                    var personDictionary = person.ToDictionary();
                    mergeObjects.Add("Person", personDictionary);

                    mergeObjects.Add("User", user.ToDictionary());

                    var recipients = new Dictionary <string, Dictionary <string, object> >();
                    recipients.Add(person.Email, mergeObjects);

                    Email email = new Email(Rock.SystemGuid.EmailTemplate.SECURITY_ACCOUNT_CREATED);
                    email.Send(recipients);

                    lSuccessCaption.Text = GetAttributeValue("SuccessCaption");
                    if (lSuccessCaption.Text.Contains("{0}"))
                    {
                        lSuccessCaption.Text = string.Format(lSuccessCaption.Text, person.FirstName);
                    }

                    ShowPanel(5);
                }
                else
                {
                    ShowErrorMessage("Invalid Person");
                }
            }
            else
            {
                ShowErrorMessage("Invalid User");
            }
        }