protected void Page_Load(object sender, EventArgs e)
 {
     module = _moduleLoader.GetModuleFromClassName("CMS.Modules.User.UserModule") as UserModule;
     if (!IsPostBack)
     {
         if (module != null)
         {
             GetDataSource();
             rptUsers.DataBind();
         }
     }
 }
예제 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this._module = base.Module as UserModule;
            if (this._module.Section.Settings["SHOW_REGISTER"] != null)
            {
                this._showRegister = Convert.ToBoolean(this._module.Section.Settings["SHOW_REGISTER"]);
            }
            if (this._module.Section.Settings["SHOW_RESET_PASSWORD"] != null)
            {
                this._showResetPassword = Convert.ToBoolean(this._module.Section.Settings["SHOW_RESET_PASSWORD"]);
            }
            if (this._module.Section.Settings["SHOW_EDIT_PROFILE"] != null)
            {
                this._showEditProfile = Convert.ToBoolean(this._module.Section.Settings["SHOW_EDIT_PROFILE"]);
            }

            bool isAuthenticated = false;

            if (Context.User != null)
            {
                isAuthenticated = Context.User.Identity.IsAuthenticated;
            }
            if (!this.IsPostBack)
            {
                if (isAuthenticated)
                {
                    this.lblLoggedInUser.Text = ((CMS.Core.Domain.User)Context.User.Identity).UserName;
                }

                this.pnlLogin.Visible         = !isAuthenticated;
                this.pnlUserInfo.Visible      = isAuthenticated;
                this.hplRegister.Visible      = this._showRegister;
                this.hplResetPassword.Visible = this._showResetPassword;
                this.hplEdit.Visible          = this._showEditProfile;
                BindLinks();
                Translate();
            }

            // Register default buttons.
            DefaultButton.SetDefault(this.Page, this.txtUsername, this.btnLogin);
            DefaultButton.SetDefault(this.Page, this.txtPassword, this.btnLogin);
        }