Пример #1
0
        private void CreateUser()
        {
            //Update DisplayName to conform to Format
            UpdateDisplayName();

            User.Membership.Approved = PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.PublicRegistration;
            var user = User;

            CreateStatus = UserController.CreateUser(ref user);

            DataCache.ClearPortalUserCountCache(PortalId);

            try
            {
                if (CreateStatus == UserCreateStatus.Success)
                {
                    //hide the succesful captcha
                    captchaRow.Visible = false;

                    //Assocate alternate Login with User and proceed with Login
                    if (!String.IsNullOrEmpty(AuthenticationType))
                    {
                        AuthenticationController.AddUserAuthentication(User.UserID, AuthenticationType, UserToken);
                    }

                    string strMessage = CompleteUserCreation(CreateStatus, user, true, IsRegister);

                    if ((string.IsNullOrEmpty(strMessage)))
                    {
                        Response.Redirect(GetRedirectUrl(), true);
                    }
                    else
                    {
                        RegistrationForm.Visible = false;
                        registerButton.Visible   = false;
                        closeLink.Visible        = true;
                    }
                }
                else
                {
                    AddLocalizedModuleMessage(UserController.GetUserCreateStatus(CreateStatus), ModuleMessage.ModuleMessageType.RedError, true);
                }
            }
            catch (Exception exc)             //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }