コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveChangesBtn_Click(object sender, EventArgs e)
        {
            Guid returnID = SaveUserData();

            if (returnID == Guid.Empty)
            {
                if (selfEdit)
                {
                    // TODO: do we need to signout? if we are hashing pwds, we can't retrieve old pwd

                    ////All should be ok now
                    ////Try logoff user
                    //PortalSecurity.SignOut( string.Empty, true );

                    ////Logon user again with new settings
                    //string actualPassword;
                    //if ( PasswordField.Text.Length != 0 )
                    //    actualPassword = PasswordField.Text;
                    //else
                    //    throw new NotSupportedException( "Changing passwords is not still supported" );

                    ////Full signon
                    //PortalSecurity.SignOn( EmailField.Text, actualPassword, false, RedirectPage );
                }
                else if (RedirectPage == string.Empty)
                {
                    // Redirect browser back to home page
                    PortalSecurity.PortalHome();
                }
                else
                {
                    Response.Redirect(RedirectPage);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Handles the Click event of the SaveChangesBtn control.
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.EventArgs"/> instance containing the event data.
        /// </param>
        protected void SaveChangesBtnClick(object sender, EventArgs e)
        {
            this.Page.Validate();
            if (this.Page.IsValid)
            {
                var returnId = this.SaveUserData();

                if (returnId == Guid.Empty)
                {
                    if (this.SelfEdit)
                    {
                        // All should be ok now
                        // Try logoff user
                        PortalSecurity.SignOut(string.Empty, true);

                        // Logon user again with new settings
                        var actualPassword = this.PasswordField.Text.Length != 0
                                                 ? this.PasswordField.Text
                                                 : this.OriginalPassword;

                        // Full signon
                        PortalSecurity.SignOn(this.EmailField.Text, actualPassword, false, this.RedirectPage);
                    }
                    else if (this.RedirectPage == string.Empty)
                    {
                        // Redirect browser back to home page
                        PortalSecurity.PortalHome();
                    }
                    else
                    {
                        this.Response.Redirect(this.RedirectPage);
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            string _user     = string.Empty;
            string _password = string.Empty;
            string _alias    = string.Empty;

            // Get Login User from querystring
            if (Request.Params["usr"] != null)
            {
                _user = Request.Params["usr"];
                // Get Login Password from querystring
                if (Request.Params["pwd"] != null)
                {
                    _password = Request.Params["pwd"];
                }
                // Get portalaias
                if (Request.Params["alias"] != null)
                {
                    _alias = HttpUrlBuilder.BuildUrl("~/Default.aspx", 0, string.Empty, Request.Params["alias"]);
                }
                //try to validate logon
                if (PortalSecurity.SignOn(_user, _password, false, _alias) == null)
                {
                    // Login failed
                    PortalSecurity.AccessDenied();
                }
            }
            else
            {
                //if user has logged on
                if (Request.IsAuthenticated)
                {
                    // Redirect user back to the Portal Home Page
                    PortalSecurity.PortalHome();
                }
                else
                {
                    //User not provided, display logon
                    signIn.Controls.Add(LoadControl("~/DesktopModules/CoreModules/SignIn/Signin.ascx"));
                }
            }
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveChangesBtn_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                Guid returnID = SaveUserData();

                if (returnID == Guid.Empty)
                {
                    if (selfEdit)
                    {
                        //All should be ok now
                        //Try logoff user
                        PortalSecurity.SignOut(string.Empty, true);

                        //Logon user again with new settings
                        string actualPassword;
                        if (PasswordField.Text.Length != 0)
                        {
                            actualPassword = PasswordField.Text;
                        }
                        else
                        {
                            actualPassword = originalPassword;
                        }

                        //Full signon
                        PortalSecurity.SignOn(EmailField.Text, actualPassword, false, RedirectPage);
                    }
                    else if (RedirectPage == string.Empty)
                    {
                        // Redirect browser back to home page
                        PortalSecurity.PortalHome();
                    }
                    else
                    {
                        Response.Redirect(RedirectPage);
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="T:System.EventArgs"/> instance containing the event data.
        /// </param>
        private void Page_Load(object sender, EventArgs e)
        {
            var _user     = string.Empty;
            var _password = string.Empty;
            var _alias    = string.Empty;
            var _pageId   = 0;

            // Get Login User from querystring
            if (this.Request.Params["usr"] != null)
            {
                _user = this.Request.Params["usr"];

                // Get Login Password from querystring
                if (this.Request.Params["pwd"] != null)
                {
                    _password = this.Request.Params["pwd"];
                }

                // Get portalaias
                if (this.Request.Params["alias"] != null)
                {
                    _alias = HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, 0, string.Empty, this.Request.Params["alias"]);
                }

                if (this.Request.Params["pageId"] != null)
                {
                    try
                    {
                        _pageId = int.Parse(this.Request.Params["pageId"]);
                        _alias  = HttpUrlBuilder.BuildUrl(_pageId);
                    }
                    catch
                    {
                        PortalSecurity.AccessDenied();
                    }
                }

                // try to validate logon
                if (PortalSecurity.SignOn(_user, _password, true, _alias) == null)
                {
                    // Login failed
                    PortalSecurity.AccessDenied();
                }
            }
            else
            {
                // if user has logged on
                if (this.Request.IsAuthenticated)
                {
                    // Redirect user back to the Portal Home Page
                    PortalSecurity.PortalHome();
                }
                else
                {
                    // User not provided, display logon
                    var controlStr = "~/DesktopModules/CoreModules/SignIn/Signin.ascx";
                    if (this.PortalSettings.CustomSettings.ContainsKey("SITESETTINGS_LOGIN_TYPE"))
                    {
                        controlStr = Convert.ToString(this.PortalSettings.CustomSettings["SITESETTINGS_LOGIN_TYPE"]);
                    }

                    try
                    {
                        this.signIn.Controls.Add(this.LoadControl(controlStr));
                    }
                    catch (Exception exc)
                    {
                        ErrorHandler.Publish(LogLevel.Error, exc);
                        this.signIn.Controls.Add(this.LoadControl("~/DesktopModules/CoreModules/SignIn/Signin.ascx"));
                    }
                }
            }
        }