Exemplo n.º 1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!EditMode && !bool.Parse(portalSettings.CustomSettings["SITESETTINGS_ALLOW_NEW_REGISTRATION"].ToString()))
            {
                PortalSecurity.AccessDeniedEdit();
            }

            Control myControl = GetCurrentProfileControl();

            EditControl = ((IEditUserProfile)myControl);
            EditControl.RedirectPage = Rainbow.HttpUrlBuilder.BuildUrl(TabID);

            register.Controls.Add(myControl);
        }
Exemplo n.º 2
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)
        {
            if (!EditMode &&
                !bool.Parse(this.PortalSettings.CustomSettings["SITESETTINGS_ALLOW_NEW_REGISTRATION"].ToString()))
                PortalSecurity.AccessDeniedEdit();

            Control myControl = GetCurrentProfileControl();

            EditControl = ((IEditUserProfile)myControl);
            EditControl.RedirectPage = HttpUrlBuilder.BuildUrl(PageID);

            register.Controls.Add(myControl);
        }
Exemplo n.º 3
0
        /// <summary>
        /// The Page_Load server event handler on this page is used
        /// to populate the role information for the page.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Verify that the current user has access to access this page
            // Removed by Mario Endara <*****@*****.**> (2004/11/04)
//			if (PortalSecurity.IsInRoles("Admins") == false)
//				PortalSecurity.AccessDeniedEdit();

            //Code no longer needed here, gman3001 10/06/2004

            /*string RegisterPage;
             *
             * //Select the actual register page
             * if (portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"] != null &&
             *              portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"].ToString() != "register.aspx" )
             *      RegisterPage = portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"].ToString();
             * else
             *      RegisterPage = "register.aspx";
             */

            // Calculate userid
            if (Request.Params["userid"] != null)
            {
                userID = Int32.Parse(Request.Params["userid"]);
            }
            if (Request.Params["username"] != null)
            {
                userName = (string)Request.Params["username"];
            }


            //Control myControl = this.LoadControl("../DesktopModules/Register/" + RegisterPage);
            //Control myControl = this.LoadControl(Rainbow.Settings.Path.WebPathCombine(Rainbow.Settings.Path.ApplicationRoot, "DesktopModules/Register", RegisterPage));
            // Line Added by gman3001 10/06/2004, to support proper loading of a register module specified by 'Register Module ID' setting in the Portal Settings admin page
            Control myControl = GetCurrentProfileControl();

            EditControl = ((IEditUserProfile)myControl);
            //EditControl.RedirectPage = HttpUrlBuilder.BuildUrl("~/Admin/UsersManage.aspx", TabID, "username="******"New User created " + DateTime.Now.ToString();
                            userName = "******" + i.ToString() + "@yoursite.com";
                            try
                            {
                                uid = users.AddUser(friendlyName, userName, string.Empty, portalSettings.PortalID);
                            }
                            catch (Exception ex)
                            {
                                uid           = -1;
                                lastException = ex;
                            }
                            i++;
                        }
                        if (uid == -1)
                        {
                            throw new Exception("New user creation failed after " + i.ToString() + " retries.", lastException);
                        }

                        // redirect to this page with the corrected querystring args
                        Response.Redirect(HttpUrlBuilder.BuildUrl("~/DesktopModules/Users/UsersManage.aspx", TabID, "mID=" + ModuleID + "&userID=" + uid + "&username="******"Error creating new user", ex);
                        ErrorLabel.Text    = ex.Message;
                        ErrorLabel.Visible = true;
                    }
                }

                BindData();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// The Page_Load server event handler on this page is used
        /// to populate the role information for the page.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            // Verify that the current user has access to access this page
            // Removed by Mario Endara <*****@*****.**> (2004/11/04)
            //			if (PortalSecurity.IsInRoles("Admins") == false)
            //				PortalSecurity.AccessDeniedEdit();

            //Code no longer needed here, gman3001 10/06/2004

            /*string RegisterPage;
             *
             * //Select the actual register page
             * if (portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"] != null &&
             *      portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"].ToString() != "register.aspx" )
             *  RegisterPage = portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"].ToString();
             * else
             *  RegisterPage = "register.aspx";
             */

            // Calculate userid
            if (Request.Params["userid"] != null)
            {
                userID = new Guid(Request.Params["userid"]);
            }

            string newUserEmail = string.Empty;

            if (Request.Params["username"] != null)
            {
                userName = (string)Request.Params["username"];
                if (userID == Guid.Empty)
                {
                    userID = (Guid)Membership.GetUser(userName).ProviderUserKey;
                }
            }
            else
            {
                allRoles.Visible    = false;
                addExisting.Visible = false;

                if (Request.Params["email"] != null)
                {
                    newUserEmail = Convert.ToString(Request.Params["email"]);
                }
            }
            bool outer = false;

            if (Request.Params["outer"] != null)
            {
                outer = Convert.ToInt32(Request.Params["outer"]) == 1 ? true : false;
            }

            //Control myControl = this.LoadControl("../DesktopModules/Register/" + RegisterPage);
            //Control myControl = this.LoadControl(Appleseed.Framework.Settings.Path.WebPathCombine(Appleseed.Framework.Settings.Path.ApplicationRoot, "DesktopModules/Register", RegisterPage));
            // Line Added by gman3001 10/06/2004, to support proper loading of a register module specified by 'Register Module ID' setting in the Portal Settings admin page
            Control myControl = GetCurrentProfileControl();

            EditControl = ((IEditUserProfile)myControl);
            //EditControl.RedirectPage = HttpUrlBuilder.BuildUrl("~/Admin/UsersManage.aspx", TabID, "username="******"New User created " + DateTime.Now.ToString();
                    //        try
                    //        {

                    //            uid = users.AddUser(friendlyName, userName, string.Empty, CurrentPortalSettings.PortalAlias);
                    //        }
                    //        catch (Exception ex)
                    //        {
                    //            uid = Guid.Empty;
                    //            lastException = ex;
                    //        }
                    //        i++;
                    //    }
                    //    if (uid == Guid.Empty)
                    //        throw new Exception("New user creation failed after " + i.ToString() + " retries.",
                    //                            lastException);

                    //    // redirect to this page with the corrected querystring args
                    //    string outerStr = outer == true ? "1" : "0";
                    //    Response.Redirect(
                    //        HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Users/UsersManage.aspx", PageID,
                    //        "mID=" + ModuleID + "&username="******"&userid=" + uid.ToString() + "&outer=" + outerStr));
                    //}
                    //catch (Exception ex)
                    //{
                    //    ErrorHandler.Publish(LogLevel.Error, "Error creating new user", ex);
                    //    ErrorLabel.Text = ex.Message;
                    //    ErrorLabel.Visible = true;
                    //}
                }

                BindData();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// The Page_Load server event handler on this page is used
        /// to populate the role information for the page.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            // Verify that the current user has access to access this page
            // Removed by Mario Endara <*****@*****.**> (2004/11/04)
            //			if (PortalSecurity.IsInRoles("Admins") == false)
            //				PortalSecurity.AccessDeniedEdit();

            //Code no longer needed here, gman3001 10/06/2004
            /*string RegisterPage;

            //Select the actual register page
            if (portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"] != null &&
                    portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"].ToString() != "register.aspx" )
                RegisterPage = portalSettings.CustomSettings["SITESETTINGS_REGISTER_TYPE"].ToString();
            else
                RegisterPage = "register.aspx";
            */

            // Calculate userid
            if (Request.Params["userid"] != null)
            {
                userID = new Guid(Request.Params["userid"]);
            }

            string newUserEmail = string.Empty;
            if (Request.Params["username"] != null) {
                userName = (string)Request.Params["username"];
                if (userID == Guid.Empty)
                {
                    userID = (Guid)Membership.GetUser(userName).ProviderUserKey;
                }

            } else {
                allRoles.Visible = false;
                addExisting.Visible = false;

                if (Request.Params["email"] != null) {
                    newUserEmail = Convert.ToString(Request.Params["email"]);
                }
            }
            bool outer = false;
            if (Request.Params["outer"] != null) {
                outer = Convert.ToInt32(Request.Params["outer"]) == 1 ? true : false;
            }

            //Control myControl = this.LoadControl("../DesktopModules/Register/" + RegisterPage);
            //Control myControl = this.LoadControl(Appleseed.Framework.Settings.Path.WebPathCombine(Appleseed.Framework.Settings.Path.ApplicationRoot, "DesktopModules/Register", RegisterPage));
            // Line Added by gman3001 10/06/2004, to support proper loading of a register module specified by 'Register Module ID' setting in the Portal Settings admin page
            Control myControl = GetCurrentProfileControl();

            EditControl = ((IEditUserProfile)myControl);
            //EditControl.RedirectPage = HttpUrlBuilder.BuildUrl("~/Admin/UsersManage.aspx", TabID, "username="******"New User created " + DateTime.Now.ToString();
                    //        try
                    //        {

                    //            uid = users.AddUser(friendlyName, userName, string.Empty, CurrentPortalSettings.PortalAlias);
                    //        }
                    //        catch (Exception ex)
                    //        {
                    //            uid = Guid.Empty;
                    //            lastException = ex;
                    //        }
                    //        i++;
                    //    }
                    //    if (uid == Guid.Empty)
                    //        throw new Exception("New user creation failed after " + i.ToString() + " retries.",
                    //                            lastException);

                    //    // redirect to this page with the corrected querystring args
                    //    string outerStr = outer == true ? "1" : "0";
                    //    Response.Redirect(
                    //        HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Users/UsersManage.aspx", PageID,
                    //        "mID=" + ModuleID + "&username="******"&userid=" + uid.ToString() + "&outer=" + outerStr));
                    //}
                    //catch (Exception ex)
                    //{
                    //    ErrorHandler.Publish(LogLevel.Error, "Error creating new user", ex);
                    //    ErrorLabel.Text = ex.Message;
                    //    ErrorLabel.Visible = true;
                    //}
                }

                BindData();
            }
        }