コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SharedBasePage requestPage = this.Page as SharedBasePage;

            if (!SiteSecurity.IsValidContributor())
            {
                Response.Redirect("~/FormatPage.aspx?path=SiteConfig/accessdenied.format.html");
            }

            this.ID = "EditUserBox";

            editControl.Text   = GetProfileContent();
            editControl.Width  = Unit.Percentage(99d);
            editControl.Height = Unit.Pixel(400);
            editControl.SetLanguage(CultureInfo.CurrentUICulture.Name);
            editControl.SetTextDirection(requestPage.ReadingDirection);

            if (!IsPostBack)
            {
                SiteConfig siteConfig  = requestPage.SiteConfig;
                User       currentUser = SiteSecurity.GetUser(requestPage.User.Identity.Name);

                textEMail.Text             = currentUser.EmailAddress;
                textDisplayName.Text       = currentUser.DisplayName;
                checkboxNewPost.Checked    = currentUser.NotifyOnNewPost;
                checkboxAllComment.Checked = currentUser.NotifyOnAllComment;
                checkboxOwnComment.Checked = currentUser.NotifyOnOwnComment;
                textPassword.Text          = passwordPlaceHolder;
                textConfirmPassword.Text   = passwordPlaceHolder;
                textOpenIdIdentifier.Text  = currentUser.OpenIDUrl;

                DataBind();
            }
        }
コード例 #2
0
        protected void buttonSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                SharedBasePage requestPage = Page as SharedBasePage;
                SiteConfig     siteConfig  = requestPage.SiteConfig;

                string userName = requestPage.User.Identity.Name;

                User user = SiteSecurity.GetUser(userName);

                // failed to retrieve the user
                if (user != null)
                {
                    if (textPassword.Text.Length > 0 && textPassword.Text != passwordPlaceHolder)
                    {
                        user.Password = textPassword.Text;
                    }

                    user.EmailAddress       = textEMail.Text;
                    user.NotifyOnNewPost    = checkboxNewPost.Checked;
                    user.NotifyOnAllComment = checkboxAllComment.Checked;
                    user.NotifyOnOwnComment = checkboxOwnComment.Checked;
                    user.DisplayName        = textDisplayName.Text;
                    user.OpenIDUrl          = textOpenIdIdentifier.Text;

                    SiteSecurity.UpdateUser(user);
                }

                SetProfileContent(editControl.Text);
                requestPage.Redirect(Page.Request.Url.AbsoluteUri);
            }
        }
コード例 #3
0
        protected override EntryCollection LoadEntries()
        {
            string userName = Request.QueryString["user"];

            User user = SiteSecurity.GetUser(userName);

            if (user != null && !String.IsNullOrEmpty(user.DisplayName))
            {
                userName = user.DisplayName;
            }

            base.TitleOverride = string.Format("{0}'s profile", userName);
            return(new EntryCollection());
        }