Beispiel #1
0
        void Login1_LoggedIn(object sender, EventArgs e)
        {
            if (IsCaptchaValid && Page.IsValid && IsPostBack)
            {
                MembershipUser user        = Membership.GetUser(Login1.UserName);
                SueetieUser    sueetieUser = SueetieUsers.GetUser(user.UserName);

                bool   hasIP = String.IsNullOrEmpty(sueetieUser.IP);
                string ip    = String.IsNullOrEmpty(sueetieUser.IP) ?
                               HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"] : sueetieUser.IP;
                if (SueetieUsers.IsIPBanned(ip))
                {
                    Response.Redirect("/members/message.aspx?msgid=9");
                }
                else
                {
                    SueetieUsers.CreateUpdateUserProfileCookie(sueetieUser);
                    SueetieLogs.LogUserEntry(UserLogCategoryType.LoggedIn, -1, sueetieUser.UserID);

                    sueetieUser.IP = ip;
                    SueetieUsers.UpdateSueetieUserIP(sueetieUser);

                    string returnUrl = Request.QueryString["ReturnUrl"];
                    if (returnUrl != null)
                    {
                        Response.Redirect(returnUrl);
                    }
                    else
                    {
                        Response.Redirect("/default.aspx", true);
                    }
                }
            }
        }
Beispiel #2
0
 public static void OnPostUserAccountApproval(SueetieUser _user)
 {
     if (saltieEvents.PostUserAccountApproval)
     {
         HandlePostUserAccountApproval(_user);
     }
 }
Beispiel #3
0
        protected override void Render(HtmlTextWriter writer)
        {
            SueetieUser user = SueetieContext.Current.User;

            string _href = SueetieUrls.Instance.MasterAccountInfo().Url;

            if (SueetieConfiguration.Get().Core.UseForumProfile)
            {
                _href = SueetieUrls.Instance.MyAccountInfo().Url;
            }

            string _imgUrl = "/images/avatars/noavatarthumbnail.jpg";

            if (user.HasAvatarImage)
            {
                _imgUrl = "/images/avatars/" + user.UserID.ToString() + "t.jpg?d=" + DateTime.Now.ToLongTimeString();
            }

            writer.BeginRender();
            writer.Write("<span class='WelcomeText'>" + string.Format(SueetieLocalizer.GetString("welcome_back"), user.DisplayName, SueetieLocalizer.GetString("welcome_exclamation")) + "</span>");
            writer.Write(string.Format("<span class='AvatarImage'><a href='{0}'><img src='{1}' alt='' /></a></span>", _href, _imgUrl));


            var aspUser = System.Web.Security.Membership.GetUser(false);

            //System.Web.Profile.ProfileManager.

            writer.Write($"<!-- ProviderUserKey = {aspUser?.ProviderUserKey} ; UserName = {aspUser?.UserName} ; DisplayName = {HttpContext.Current.Profile["DisplayName"]} -->");

            writer.EndRender();
        }
        public static void CreateProfile(SueetieUser sueetieUser, string _blogRoot)
        {
            string filename = System.Web.HttpContext.Current.Server.MapPath("/" + _blogRoot + "/app_data/profiles/" + sueetieUser.UserName + ".xml");

            if (!File.Exists(filename))
            {
                XDocument doc = new XDocument(
                    new XElement("profileData",
                                 new XElement("DisplayName", sueetieUser.DisplayName),
                                 new XElement("FirstName"),
                                 new XElement("MiddleName"),
                                 new XElement("LastName"),
                                 new XElement("CityTown"),
                                 new XElement("RegionState"),
                                 new XElement("Country"),
                                 new XElement("Birthday", "0001-01-01"),
                                 new XElement("AboutMe"),
                                 new XElement("PhotoURL"),
                                 new XElement("Company"),
                                 new XElement("EmailAddress"),
                                 new XElement("PhoneMain"),
                                 new XElement("PhoneMobile"),
                                 new XElement("PhoneFax"),
                                 new XElement("LastName"),
                                 new XElement("IsPrivate", "False")
                                 )
                    );
                doc.Save(filename);
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            SueetieUser user = SueetieContext.Current.User;

            Label _userContentCountLabel = new Label();

            _userContentCountLabel.Text     = user.DisplayName + " has created " + SaltieUsers.GetContentCount(user.UserID) + " content items!";
            _userContentCountLabel.CssClass = this.CSSClass;
            Controls.Add(_userContentCountLabel);
        }
Beispiel #6
0
        private void Page_Load()
        {
            // check if username exists in the query string
            username            = Request.QueryString["username"];
            sueetieUser         = SueetieUsers.GetUser(username);
            lblDisplayName.Text = sueetieUser.DisplayName;

            SueetieUIHelper.PopulateTimeZoneList(ddTimeZones, sueetieUser.TimeZone.ToString());

            if (username == null || username == "")
            {
                Response.Redirect("users.aspx");
            }

            // get membership user account based on username sent in query string
            _user            = Membership.GetUser(username, false);
            lastActivitydate = _user.LastActivityDate;

            UserUpdateMessage.Text = "";

            if (_user.IsLockedOut)
            {
                ActionMessage.Visible = true;
                ActionMessage.Text    = "User is locked out.  Use the \"Unlock User\" button to unlock";
            }
            else
            {
                string bannedIntro   = "This user's IP mask (" + SueetieIPHelper.GetIPMask(sueetieUser.IP) + ") is recorded as banned. Click 'Lift Ban on this User' to permit the user to login or create a new account.";
                string unbannedIntro = "User is not banned. Click 'Ban User' to record user's IP mask as banned to thwart attempts to create new site accounts.";
                if (!Page.IsPostBack)
                {
                    if (sueetieUser.IsBanned)
                    {
                        trBan.Visible       = false;
                        lblBannedIntro.Text = bannedIntro;
                    }
                    else
                    {
                        trUnBan.Visible     = false;
                        lblBannedIntro.Text = unbannedIntro;
                    }


                    SueetieUserProfile profile = SueetieUsers.GetSueetieUserProfile(sueetieUser.UserID);

                    txtDisplayName.Text   = profile.DisplayName;
                    chkNewsletter.Checked = profile.Newsletter;
                }

                _user.LastActivityDate = lastActivitydate;
                Membership.UpdateUser(_user);
                _user = Membership.GetUser(username, false);
            }
        }
Beispiel #7
0
        private MailMessage AddFromAndSubject(MailMessage _msg, SueetieUser _user)
        {
            _msg.From = new MailAddress(SiteSettings.Instance.ContactEmail,
                                        string.Format(SueetieLocalizer.GetString("forgot_username_user_services"), SiteSettings.Instance.SiteName));
            _msg.Subject = string.Format(SueetieLocalizer.GetString("forgot_username_your_accountinfo"), SiteSettings.Instance.SiteName);

            MailAddress userAddress = new MailAddress(_user.Email, _user.DisplayName);

            _msg.To.Add(userAddress);
            return(_msg);
        }
        protected void btnUpdateBio_OnClick(object sender, EventArgs args)
        {
            SueetieUser sueetieUser = new SueetieUser
            {
                UserID = CurrentSueetieUser.UserID,
                Bio    = txtBio.Text
            };


            SueetieUsers.ClearUserCache(CurrentSueetieUser.UserID);
            SueetieUsers.UpdateSueetieUserBio(sueetieUser);
            Response.Redirect("myaccountinfo.aspx?bio=1");
        }
        // Sueetie Modified - Show SueetieUser Avatar

        protected string GetSueetieUserAvatar(int height, int width)
        {
            string      img         = "<img class=\"thumbnail\" src=\"{0}\" alt=\"{1}\" height=\"{2}\" width=\"{3}\" />";
            SueetieUser sueetieUser = SueetieUsers.GetThinSueetieUserFromEmail(Comment.Email);

            if (sueetieUser != null)
            {
                return(string.Format(img, SueetieUsers.GetUserAvatarUrl(sueetieUser.UserID, true), sueetieUser.DisplayName, height, width));
            }
            else
            {
                return(string.Format(img, SueetieUsers.GetUserAvatarUrl(-2, true), string.Empty, height, width));
            }
        }
Beispiel #10
0
        private bool IsInViewableRole(SueetieUser _user)
        {
            bool _isInViewableRole = false;

            if (this.Roles != null)
            {
                string[] rolesList = this.Roles.Split(',');
                foreach (string role in rolesList)
                {
                    if (_user.IsInRole(role))
                    {
                        _isInViewableRole = true;
                    }
                }
            }
            return(_isInViewableRole);
        }
Beispiel #11
0
    public string CreateWikiUsers(string _userIDs)
    {
        string[] userIDs  = _userIDs.Split(',');
        string   newusers = string.Empty;

        foreach (string userID in userIDs)
        {
            if (!string.IsNullOrEmpty(userID))
            {
                SueetieUser sueetieUser = SueetieUsers.GetUser(Convert.ToInt32(userID));
                WikiUsers.AddUser(sueetieUser.UserName, sueetieUser.Email, null, sueetieUser.DisplayName);
                newusers += sueetieUser.DisplayName + ",";
            }
        }

        return("The following now have wiki accounts: " + DataHelper.CommaTrim(newusers));
    }
Beispiel #12
0
        private bool IsUserAuthorizedForLink(SueetieUser user, string role)
        {
            bool isUserAuthorizedForLink = true;

            if (role != null)
            {
                if (user.IsInRole(role))
                {
                    isUserAuthorizedForLink = true;
                }
                else
                {
                    isUserAuthorizedForLink = false;
                }
            }
            return(isUserAuthorizedForLink);
        }
Beispiel #13
0
        private static bool IsUserAuthorizedForTab(SueetieUser user, string roles)
        {
            bool isUserAuthorizedForTab = true;

            if (roles != null)
            {
                isUserAuthorizedForTab = false;
                string[] rolesList = roles.Split(',');
                foreach (string role in rolesList)
                {
                    if (user.IsInRole(role))
                    {
                        isUserAuthorizedForTab = true;
                    }
                }
            }
            return(isUserAuthorizedForTab);
        }
Beispiel #14
0
        private static bool IsAnonymousTab(SueetieUser user, string roles)
        {
            bool isAnonymousTab = true;

            if (roles != null)
            {
                isAnonymousTab = false;
                string[] rolesList = roles.Split(',');
                foreach (string role in rolesList)
                {
                    if (user.IsAnonymous && role.ToLower() == "anonymous")
                    {
                        isAnonymousTab = true;
                    }
                }
            }
            return(isAnonymousTab);
        }
Beispiel #15
0
        protected void btnUpdateProfile_Click(object sender, EventArgs e)
        {
            SaveProfile();
            lblProfileMessage.Text = "Profile saved successfully!";

            _user.LastActivityDate = lastActivitydate;
            Membership.UpdateUser(_user);
            _user = Membership.GetUser(username, false);

            sueetieUser             = SueetieUsers.GetUser(username);
            sueetieUser.DisplayName = txtDisplayName.Text.Trim();
            SueetieUsers.UpdateDisplayName(sueetieUser);

            sueetieUser.DisplayName = txtDisplayName.Text.Trim();
            sueetieUser.TimeZone    = Convert.ToInt32(ddTimeZones.SelectedValue);

            SueetieUsers.UpdateSueetieUser(sueetieUser);
            SueetieUsers.ClearUserProfileCache(sueetieUser.UserID);
        }
Beispiel #16
0
        public void Page_Load()
        {
            Label  _menu           = new Label();
            string highlightedmenu = string.Empty;

            string htmlkey       = FooterMenuHTMLCacheKey();
            string MenuHTML      = SueetieCache.Current[htmlkey] as string;
            string _currentTheme = this.CurrentTheme;

            if (IsAdminFooter)
            {
                _currentTheme = SueetieConfiguration.Get().Core.AdminTheme;
            }

            if (MenuHTML == null)
            {
                string       file = HttpContext.Current.Server.MapPath("/themes/") + _currentTheme + "\\config\\footer.config";
                StreamReader sr   = new StreamReader(file);
                MenuHTML += sr.ReadToEnd();
                sr.Close();
                SueetieCache.Current.Insert(htmlkey, MenuHTML);
            }

            SueetieUser user = SueetieContext.Current.User;

            foreach (FooterMenuLink link in SueetieConfiguration.Get().FooterMenuLinks)
            {
                if (!IsUserAuthorizedForLink(user, link.role))
                {
                    highlightedmenu = MenuHTML.Replace("id=\"" + link.id + "\"", "id=\"" + link.id + "\" style=\"display:none;\"");
                }
                else
                {
                    highlightedmenu = MenuHTML;
                }

                MenuHTML = highlightedmenu;
            }

            _menu.Text = highlightedmenu;
            Controls.Add(_menu);
        }
Beispiel #17
0
    public List <Pair> ProfileUserFollow(int userID, int profileUserID, bool stopFollowing)
    {
        if (userID > 0)
        {
            SueetieUser   sueetieFollowingUser = SueetieUsers.GetUser(profileUserID);
            string        result        = "You are now following " + sueetieFollowingUser.DisplayName;
            SueetieFollow sueetieFollow = new SueetieFollow
            {
                FollowerUserID    = userID,
                FollowingUserID   = profileUserID,
                ContentIDFollowed = -1
            };

            if (sueetieFollow.FollowerUserID == sueetieFollow.FollowingUserID)
            {
                result = "Sorry, you cannot follow yourself...";
            }
            else
            {
                if (!stopFollowing)
                {
                    int followID = SueetieUsers.FollowUser(sueetieFollow);
                }
                else
                {
                    SueetieUsers.UnFollowUser(sueetieFollow);
                    result = "You are no longer following " + sueetieFollowingUser.DisplayName;
                }
            }
            List <Pair> followResult = new List <Pair>();
            followResult.Add(new Pair(stopFollowing, result));

            return(followResult);
        }
        else
        {
            List <Pair> followResult = new List <Pair>();
            followResult.Add(new Pair(stopFollowing, "Please login or become a member to follow this person."));

            return(followResult);
        }
    }
        public void SaveProfile()
        {
            if (Page.User.Identity.IsAuthenticated)
            {
                #region Control Value Assignments

                if (HasNewsletterCheckBox)
                {
                    Newsletter = chkNewsletter.Checked;
                }

                #endregion

                List <Pair> _properties = new List <Pair>()
                {
                    new Pair("DisplayName", txtDisplayName.Text),
                    new Pair("Newsletter", Newsletter.ToString())
                };

                Pair _propertyKeyValuePair = SueetieUsers.GenerateProfileKeyValues(_properties);
                SueetieUsers.UpdateSueetieUserProfile(_propertyKeyValuePair, CurrentSueetieUserID);

                MembershipUser user = Membership.GetUser();
                user.Email = txtEmail.Text;
                Membership.UpdateUser(user);

                SueetieUser sueetieUser = new SueetieUser
                {
                    UserName     = CurrentSueetieUser.UserName,
                    UserID       = CurrentSueetieUser.UserID,
                    Email        = txtEmail.Text.ToLower(),
                    DisplayName  = txtDisplayName.Text,
                    IsActive     = true,
                    TimeZone     = Convert.ToInt32(ddTimeZones.SelectedValue),
                    MembershipID = CurrentSueetieUser.MembershipID
                };

                SueetieUsers.UpdateSueetieUser(sueetieUser);
                SueetieUsers.ClearUserProfileCache(CurrentSueetieUser.UserID);
            }
        }
Beispiel #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["u"] == null)
            {
                Response.Redirect("Message.aspx");
            }
            else
            {
                int userID = DataHelper.GetIntFromQueryString("u", -1);
                if (userID > 0)
                {
                    if (SueetieConfiguration.Get().Core.UseForumProfile)
                    {
                        int    forumUserID = SueetieUsers.GetThinSueetieUser(userID).ForumUserID;
                        string profileUrl  = SueetieUrls.Instance.MasterProfile(forumUserID).Url;
                        Response.Redirect(profileUrl);
                    }
                    UserProfiled = SueetieUsers.GetUser(int.Parse(Request.QueryString["u"].ToString()));
                    if (UserProfiled.IsAnonymous)
                    {
                        Response.Redirect("Message.aspx?msg=1");
                    }
                    else
                    {
                        if (UserProfiled.HasAvatarImage)
                        {
                            AvatarImg.ImageUrl = "/images/avatars/" + UserProfiled.AvatarFilename;
                        }
                        else
                        {
                            AvatarImg.ImageUrl = "/images/avatars/noavatar.jpg";
                        }
                        lblMemberSince.Text = UserProfiled.DisplayName + " has been a member of the Sueetie Community since " + UserProfiled.DateJoined.ToString("y");

                        lblBio.Text = DataHelper.DefaultTextIt(UserProfiled.Bio, UserProfiled.DisplayName + " has not yet created a bio.");
                        Page.Title  = SueetieLocalizer.GetString("memberprofile_title") + UserProfiled.DisplayName;
                    }
                }
            }
        }
Beispiel #20
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            SueetieUser user = SueetieContext.Current.User;

            if (IsInViewableRole(user) || (user.IsAnonymous && this.IsAnonymous == IsAnonymousPlaceHolder.True))
            {
                TrueContentTemplate.InstantiateIn(this);
                base.Render(writer);
            }
            else
            {
                if (FalseContentTemplate != null)
                {
                    FalseContentTemplate.InstantiateIn(this);
                    base.Render(writer);
                }
                else
                {
                    this.Visible = false;
                }
            }
        }
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            SueetieUser user = SueetieContext.Current.User;

            if (user.IsInRole(Role.ToString()) || (user.IsAnonymous && this.Role == UserRole.NonMember))
            {
                TrueContentTemplate.InstantiateIn(this);
                base.Render(writer);
            }
            else
            {
                if (FalseContentTemplate != null)
                {
                    FalseContentTemplate.InstantiateIn(this);
                    base.Render(writer);
                }
                else
                {
                    this.Visible = false;
                }
            }
        }
Beispiel #22
0
    public string CreateBlogAdmin(string _userIDs)
    {
        string[] userIDs   = _userIDs.Split(',');
        string   newadmins = string.Empty;

        foreach (string userID in userIDs)
        {
            if (!string.IsNullOrEmpty(userID))
            {
                SueetieUser sueetieUser = SueetieUsers.GetUser(Convert.ToInt32(userID));
                SueetieBlogs.CreateBlogAdmin(sueetieUser);
                SueetieBlogUtils.CreateProfile(sueetieUser, "blog");
                if (!sueetieUser.IsBlogAdministrator)
                {
                    Roles.AddUserToRole(sueetieUser.UserName, "BlogAdministrator");
                }
                newadmins += sueetieUser.DisplayName + ",";
            }
        }

        return("The following are now site blog administrators: " + DataHelper.CommaTrim(newadmins));
    }
Beispiel #23
0
        protected void SendEmail_Click(object sender, EventArgs e)
        {
            if (txtEmail.Text.Length == 0)
            {
                ResultsText.Text = SueetieLocalizer.GetString("forgot_username_empty_email");
                return;
            }
            SueetieUser sueetieUser = SueetieUsers.GetSueetieUserByEmail(txtEmail.Text);

            if (String.IsNullOrEmpty(sueetieUser.UserName))
            {
                ResultsText.Text = SueetieLocalizer.GetString("forgot_username_notindatabase");
                return;
            }

            MailMessage msg = new MailMessage();

            AddFromAndSubject(msg, sueetieUser);
            AddBody(msg, sueetieUser);
            SendIt(msg);

            ResultsText.Text = SueetieLocalizer.GetString("forgot_username_sent_msg", new string[] { txtEmail.Text });
        }
Beispiel #24
0
        private MailMessage AddBody(MailMessage _msg, SueetieUser _user)
        {
            string body = string.Empty;

            _msg.IsBodyHtml = true;
            MembershipUser membershipUser = Membership.GetUser(_user.UserName);
            Uri            uri            = HttpContext.Current.Request.Url;

            body += "<div style=\"font-family: Arial; font-size: 16px; margin-bottom: 15px;\">";
            body += string.Format(SueetieLocalizer.GetString("forgot_username_as_requested"), SiteSettings.Instance.SiteName) + "</div>";
            body += "<div style=\"font-family: Arial; font-size: 14px; margin-bottom: 25px;\">";
            body += "</div>";
            body += "<div style=\"font-family: Arial; font-size: 14px; font-weight: bold; margin-bottom: 15px;\">";
            body += string.Format(SueetieLocalizer.GetString("forgot_username_your_username"), _user.UserName) + "<br />";
            body += string.Format(SueetieLocalizer.GetString("forgot_username_your_password"), membershipUser.ResetPassword()) + "<br />";
            body += "</div>";

            body += "<div style=\"font-family: Tahoma; font-size: 11px; font-weight: normal; margin-bottom: 15px;\">";
            body += "_______________________________________________________<br /><br />";
            body += "<a href=\"http://" + uri.Host + "\">" + string.Format(SueetieLocalizer.GetString("forgot_username_homepage_link"), SiteSettings.Instance.SiteName) + "</a></div>";

            _msg.Body = body;
            return(_msg);
        }
Beispiel #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MembershipUser user;

            string username  = Request.QueryString["uname"];
            string valBinary = Request.QueryString["key"];
            int    userid    = DataHelper.GetIntFromQueryString("uid", -1);

            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(valBinary) && userid > 0)
            {
                user = Membership.GetUser(username);

                SueetieUser sueetieUser = SueetieUsers.GetUser(username);

                if ((user.IsApproved == false) && (valBinary == user.CreationDate.ToBinary().ToString()) && !sueetieUser.IsBanned)
                {
                    user.IsApproved = true;
                    Membership.UpdateUser(user);
                    SueetieUsers.CreateUpdateUserProfileCookie(sueetieUser);
                    SueetieLogs.LogUserEntry(UserLogCategoryType.JoinedCommunity, -1, userid);

                    phActivated.Visible = true;
                    phNot.Visible       = false;
                }
                else
                {
                    phActivated.Visible = false;
                    phNot.Visible       = true;
                }
            }
            else
            {
                phActivated.Visible = false;
                phNot.Visible       = true;
            }
        }
Beispiel #26
0
        protected override void OnLoad(EventArgs e)
        {
            Image _avatarImage = new Image();

            if (AvatarSueetieUser == null)
            {
                AvatarSueetieUser = CurrentSueetieUser;
            }

            if (AvatarSueetieUser != null)
            {
                _avatarImage.ImageUrl      = SueetieUsers.GetUserAvatarUrl(AvatarSueetieUser.UserID, this.UseOriginalImage, this.UseCachedAvatarRoot);
                _avatarImage.AlternateText = AvatarSueetieUser.DisplayName;

                string _profileUrl = SueetieUrls.Instance.MasterProfile(AvatarSueetieUser.ForumUserID).Url;
                if (PostBackToProfile)
                {
                    if (!SueetieConfiguration.Get().Core.UseForumProfile)
                    {
                        _profileUrl = SueetieUrls.Instance.MyProfile(AvatarSueetieUser.UserID).Url;
                    }
                    _avatarImage.Attributes.Add("onClick", "javascript:window.open('" + _profileUrl + "','_self')");
                }
            }
            else
            {
                _avatarImage.ImageUrl = SueetieUsers.GetUserAvatarUrl(-2, this.UseOriginalImage);
            }
            _avatarImage.Style.Add("height", this.Height.ToString() + "px");
            _avatarImage.Style.Add("width", this.Width.ToString() + "px");
            _avatarImage.Style.Add("border-width", this.BorderWidth.ToString() + "px");
            _avatarImage.CssClass = this.CssClass;


            Controls.Add(_avatarImage);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager1.RegisterPostBackControl(UpdateUpload);
            ScriptManager1.RegisterPostBackControl(DeleteAvatarButton);
            ScriptManager1.RegisterPostBackControl(btnUpdateBio);
            ScriptManager1.RegisterPostBackControl(ChangePasswordButton);

            if (Request.QueryString["dv"] == "1" || Request.QueryString["av"] == "1" || Request.QueryString["iv"] == "1")
            {
                TabContainer1.ActiveTabIndex = 2;
            }
            else if (Request.QueryString["bio"] == "1")
            {
                TabContainer1.ActiveTabIndex = 2;
            }
            else if (Request.QueryString["pr"] == "1")
            {
                TabContainer1.ActiveTabIndex = 0;
            }
            else
            {
                TabContainer1.ActiveTabIndex = 0;
            }

            if (!Page.IsPostBack)
            {
                if (Page.User.Identity.IsAuthenticated)
                {
                    SueetieUser sueetieUser = SueetieUsers.GetUser(CurrentUserID, false);
                    SetActiveButtonAttributes(CancelButton);
                    SetActiveButtonAttributes(ChangePasswordButton);
                    SetActiveButtonAttributes(btnUpdateProfile);
                    SetActiveButtonAttributes(btnUpdateBio);


                    SueetieUIHelper.PopulateTimeZoneList(ddTimeZones, sueetieUser.TimeZone.ToString());
                    SueetieUserProfile profile = CurrentSueetieUser.Profile;

                    txtCurrentPassword.Text = string.Empty;
                    txtDisplayName.Text     = sueetieUser.DisplayName;
                    txtEmail.Text           = sueetieUser.Email;

                    #region Optional Profile Property Assignments


                    if (chkNewsletter != null)
                    {
                        HasNewsletterCheckBox = true;
                        chkNewsletter.Checked = profile.Newsletter;
                    }

                    #endregion

                    // When using ProfileBase...
                    //ProfileBase profile = HttpContext.Current.Profile;
                    //txtDisplayName.Text = profile["DisplayName"] as string;
                    //ddlGenders.SelectedValue = profile["Gender"] as string;
                    //ddlOccupations.SelectedValue = profile["Occupation"] as string;
                    //txtWebsite.Text = profile["Website"] as string;
                    //txtTwitterName.Text = profile["TwitterName"] as string;
                    //ddlCountries.SelectedValue = profile["Country"] as string;

                    txtBio.Text = sueetieUser.Bio;
                }
            }

            BindData();
        }
Beispiel #28
0
        protected void CreateUser_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid && IsPostBack)
            {
                if (Membership.GetUser(txtUsername.Text) == null && Membership.GetUserNameByEmail(txtEmailAddress.Text) == null)
                {
                    var ws = new SueetieService();

                    MembershipUser user = Membership.CreateUser(txtUsername.Text, txtPassword1.Text, txtEmailAddress.Text);

                    ProfileBase profile = (ProfileBase)SueetieUserProfile.Create(txtUsername.Text, true);
                    profile["DisplayName"] = txtDisplayName.Text;
                    profile["Newsletter"]  = chkNewsletter.Checked;
                    profile.Save();


                    // SUEETIE NOTE: [BLOG]  BlogEngine.NET will throw an error if authorizing a user and they do not appear in be_User table.
                    // When Blog Application added, uncomment these lines.

                    beDataContext dataContext = new beDataContext();

                    be_User _be_User = new be_User();
                    _be_User.UserName      = user.UserName;
                    _be_User.Password      = string.Empty;
                    _be_User.LastLoginTime = DateTime.Now;
                    _be_User.EmailAddress  = user.Email;
                    dataContext.be_Users.InsertOnSubmit(_be_User);
                    dataContext.SubmitChanges();

                    Roles.AddUserToRole(user.UserName, "Registered");

                    // SUEETIE NOTE: [WIKI]  Adding user to ScrewTurn Wiki v3 /public/users.cs.

                    if (SiteSettings.Instance.CreateWikiUserAccount)
                    {
                        WikiUsers.AddUser(txtUsername.Text, txtEmailAddress.Text, null, txtDisplayName.Text);
                    }

                    // SUEETIE NOTE: SueetieUser creation

                    SueetieUser sueetieUser = new SueetieUser();
                    sueetieUser.UserName     = user.UserName.ToLower();
                    sueetieUser.Email        = user.Email.ToLower();
                    sueetieUser.MembershipID = (Guid)user.ProviderUserKey;
                    sueetieUser.DisplayName  = txtDisplayName.Text;
                    sueetieUser.IP           = "127.0.0.1";
                    sueetieUser.IsActive     = true;
                    sueetieUser.TimeZone     = Convert.ToInt32(ddTimeZones.SelectedValue);

                    int userid = SueetieUsers.CreateSueetieUser(sueetieUser);

                    // SUEETIE NOTE: As of Gummy Bear 1.3, a Forum User Account is Created for All Users
                    SueetieForums.CreateForumUser(sueetieUser);

                    SueetieUsers.ClearSueetieUserListCache(SueetieUserType.RegisteredUser);

                    txtDisplayName.Text = txtEmailAddress.Text = txtPassword1.Text = txtPassword2.Text = txtUsername.Text = string.Empty;

                    lblResults.Visible = true;
                    lblResults.Text    = "User Account Created!";
                }
                else
                {
                    string loginUrl = "login.aspx";
                    if (Request.QueryString["ReturnUrl"] != null)
                    {
                        loginUrl += "?ReturnUrl=" + Request.QueryString["ReturnUrl"];
                    }

                    if (Membership.GetUser(txtUsername.Text) != null)
                    {
                        labelUserMessage.Text = "User already exists.  Please enter another username.  If you already have a Sueetie account, please <a href=\"" + loginUrl + "\">login here.</a>";
                    }

                    else if (Membership.GetUserNameByEmail(txtEmailAddress.Text) != null)
                    {
                        labelUserMessage.Text = "The email address already exists.  Do you already have a Sueetie account?  If so, please <a href=\"" + loginUrl + "\">login here.</a>";
                    }
                }
            }
        }
Beispiel #29
0
        public void Page_Load()
        {
            Label _menu = new Label();

            string highlightedmenu = string.Empty;

            string htmlkey  = MenuHTMLCacheKey();
            string MenuHTML = SueetieCache.Current[htmlkey] as string;

            if (MenuHTML == null)
            {
                string       file = HttpContext.Current.Server.MapPath("/themes/") + this.CurrentTheme + "\\config\\menu.config";
                StreamReader sr   = new StreamReader(file);
                MenuHTML += sr.ReadToEnd();
                sr.Close();
                SueetieCache.Current.Insert(htmlkey, MenuHTML);
            }

            SueetieUser user     = SueetieContext.Current.User;
            bool        _noLight = true;

            foreach (SiteMenuTab tab in SueetieConfiguration.Get().SiteMenuTabs)
            {
                if (IsUserAuthorizedForTab(user, tab.roles))
                {
                    if (IsGroup && _noLight)
                    {
                        highlightedmenu = MenuHTML.Replace("id=\"GroupsTab\"", "id=\"GroupsTab\" class=\"current\"");
                        _noLight        = false;
                    }
                    else if (HttpContext.Current.Request.RawUrl.ToLower().Contains("/search/") && _noLight)
                    {
                        highlightedmenu = MenuHTML.Replace("id=\"SearchTab\"", "id=\"SearchTab\" class=\"current\"");
                        _noLight        = false;
                    }
                    else if (HttpContext.Current.Request.RawUrl.ToLower() == tab.url && _noLight)
                    {
                        highlightedmenu = MenuHTML.Replace("id=\"" + tab.id + "\"", "id=\"" + tab.id + "\" class=\"current\"");
                        _noLight        = false;
                    }
                    else if (String.Compare(SueetieApplications.Current.ApplicationKey, tab.appkey, true) == 0 && ShowAppTab(tab) && _noLight)
                    {
                        highlightedmenu = MenuHTML.Replace("id=\"" + tab.id + "\"", "id=\"" + tab.id + "\" class=\"current\"");
                        _noLight        = false;
                    }
                    else if (String.Compare(SueetieApplications.Current.ApplicationName, tab.app, true) == 0 && ShowAppTab(tab) && _noLight)
                    {
                        highlightedmenu = MenuHTML.Replace("id=\"" + tab.id + "\"", "id=\"" + tab.id + "\" class=\"current\"");
                        _noLight        = false;
                    }
                    else
                    {
                        highlightedmenu = MenuHTML;
                    }
                }
                else if (!IsAnonymousTab(user, tab.roles))
                {
                    highlightedmenu = MenuHTML.Replace("id=\"" + tab.id + "\"", "id=\"" + tab.id + "\" style=\"display:none;\"");
                }

                MenuHTML = highlightedmenu;
            }

            highlightedmenu = MenuHTML.Replace("id=\"" + HighlightTab + "\"", "id=\"" + HighlightTab + "\" class=\"current\"");
            _menu.Text      = highlightedmenu;
            Controls.Add(_menu);
        }
 public static bool HasPriorVersionLicense(this SueetieUser _user, ProductPackage _productPackage, ProductLicenseType _productLicenseType)
 {
     return(Licenses.GetProductLicenseList().Any <ProductLicense>(l => ((((l.PackageTypeID == _productPackage.PackageTypeID) && (l.LicenseTypeID >= (int)_productLicenseType)) && (l.MajorVersion < _productPackage.MajorVersion)) && (l.UserID == _user.UserID))));
 }