Exemplo n.º 1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this._module = base.Module as UserModule;
            this._authenticationService = IoC.Resolve <IAuthenticationService>();

            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 = ((Cuyahoga.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);
        }
Exemplo n.º 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 = ((Cuyahoga.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);
        }