예제 #1
0
        public void ValidateKey_Click(object sender, System.EventArgs e)
        {
            DataTable dt      = YAF.Classes.Data.DB.checkemail_update(key.Text);
            DataRow   row     = dt.Rows [0];
            string    dbEmail = row ["Email"].ToString();

            bool keyVerified = (row["ProviderUserKey"] == DBNull.Value) ? false : true;

            approved.Visible = keyVerified;
            error.Visible    = !keyVerified;

            if (keyVerified)
            {
                // approve and update e-mail in the membership as well...
                System.Web.Security.MembershipUser user = UserMembershipHelper.GetMembershipUser(row ["ProviderUserKey"]);
                if (!user.IsApproved)
                {
                    user.IsApproved = true;
                }
                // update the email if anything was returned...
                if (user.Email != dbEmail && dbEmail != "")
                {
                    user.Email = dbEmail;
                }
                // tell the provider to update...
                System.Web.Security.Membership.UpdateUser(user);

                // now redirect to login...
                PageContext.AddLoadMessageSession(GetText("EMAIL_VERIFIED"));

                YafBuildLink.Redirect(ForumPages.login);
            }
        }
예제 #2
0
        protected void Import_OnClick(object sender, System.EventArgs e)
        {
            // import selected file (if it's the proper format)...
            if (importFile.PostedFile.ContentType == "text/xml")
            {
                try
                {
                    int importedCount = YAF.Classes.Data.Import.DataImport.BBCodeExtensionImport(PageContext.PageBoardID, importFile.PostedFile.InputStream);

                    if (importedCount > 0)
                    {
                        PageContext.AddLoadMessageSession(String.Format("{0} new custom bbcode(s) imported successfully.", importedCount));
                    }
                    else
                    {
                        PageContext.AddLoadMessageSession(String.Format("Nothing imported: no new custom bbcode was found in the upload.", importedCount));
                    }

                    YafBuildLink.Redirect(ForumPages.admin_bbcode);
                }
                catch (Exception x)
                {
                    PageContext.AddLoadMessage("Failed to import: " + x.Message);
                }
            }
        }
예제 #3
0
        protected void Import_OnClick(object sender, System.EventArgs e)
        {
            // import selected file (if it's the proper format)...
            if (importFile.PostedFile.ContentType == "text/xml")
            {
                try
                {
                    // import replace words...
                    DataSet dsReplaceWords = new DataSet();
                    dsReplaceWords.ReadXml(importFile.PostedFile.InputStream);

                    if (dsReplaceWords.Tables ["YafReplaceWords"] != null &&
                        dsReplaceWords.Tables ["YafReplaceWords"].Columns["badword"] != null &&
                        dsReplaceWords.Tables ["YafReplaceWords"].Columns["goodword"] != null)
                    {
                        int importedCount = 0;

                        DataTable replaceWordsList = DB.replace_words_list(PageContext.PageBoardID, null);
                        // import any extensions that don't exist...
                        foreach (DataRow row in dsReplaceWords.Tables["YafReplaceWords"].Rows)
                        {
                            if (replaceWordsList.Select(String.Format("badword = '{0}' AND goodword = '{1}'", row["badword"].ToString(), row["goodword"].ToString())).Length == 0)
                            {
                                // add this...
                                DB.replace_words_save(PageContext.PageBoardID, null, row["badword"], row["goodword"]);
                                importedCount++;
                            }
                        }

                        if (importedCount > 0)
                        {
                            PageContext.AddLoadMessageSession(String.Format("{0} new replacement word(s) were imported successfully.", importedCount));
                        }
                        else
                        {
                            PageContext.AddLoadMessageSession(String.Format("Nothing imported: no new replacement words were found in the upload.", importedCount));
                        }

                        YafBuildLink.Redirect(ForumPages.admin_replacewords);
                    }
                    else
                    {
                        PageContext.AddLoadMessage("Failed to import: Import file format is different than expected.");
                    }
                }
                catch (Exception x)
                {
                    PageContext.AddLoadMessage("Failed to import: " + x.Message);
                }
            }
        }
예제 #4
0
        protected void PasswordRecovery1_VerifyingUser(object sender, LoginCancelEventArgs e)
        {
            MembershipUser user = Membership.GetUser(PasswordRecovery1.UserName);

            if (user != null)
            {
                // verify the user is approved, etc...
                if (!user.IsApproved)
                {
                    if (PageContext.BoardSettings.EmailVerification)
                    {
                        // get the hash from the db associated with this user...
                        DataTable dt = DB.checkemail_list(user.Email);

                        if (dt.Rows.Count > 0)
                        {
                            string hash = dt.Rows [0] ["hash"].ToString();

                            // re-send verification email instead of lost password...
                            YafTemplateEmail verifyEmail = new YafTemplateEmail("VERIFYEMAIL");

                            string subject = String.Format(GetText("VERIFICATION_EMAIL_SUBJECT"), PageContext.BoardSettings.Name);

                            verifyEmail.TemplateParams ["{link}"]      = String.Format("{1}{0}", YafBuildLink.GetLinkNotEscaped(ForumPages.approve, "k={0}", hash), YafForumInfo.ServerURL);
                            verifyEmail.TemplateParams ["{key}"]       = hash;
                            verifyEmail.TemplateParams ["{forumname}"] = PageContext.BoardSettings.Name;
                            verifyEmail.TemplateParams ["{forumlink}"] = String.Format("{0}", YafForumInfo.ForumURL);

                            verifyEmail.SendEmail(new System.Net.Mail.MailAddress(user.Email, user.UserName), subject, true);

                            PageContext.AddLoadMessageSession(String.Format(PageContext.Localization.GetText("ACCOUNT_NOT_APPROVED_VERIFICATION"), user.Email));
                        }
                    }
                    else
                    {
                        // explain they are not approved yet...
                        PageContext.AddLoadMessageSession(PageContext.Localization.GetText("ACCOUNT_NOT_APPROVED"));
                    }

                    // just in case cancel the verification...
                    e.Cancel = true;

                    // nothing they can do here... redirect to login...
                    YafBuildLink.Redirect(ForumPages.login);
                }
            }
        }
예제 #5
0
 protected void PasswordRecovery1_AnswerLookupError(object sender, EventArgs e)
 {
     PageContext.AddLoadMessageSession(GetText("QUESTION_FAILURE"));
 }