Exemple #1
0
 private bool ValidateVerifyCode()
 {
     if (String.IsNullOrEmpty(DNTRequest.GetString("vcode")))
     {
         if (!(this.pagename == "showforum.aspx"))
         {
             if (this.pagename.EndsWith("ajax.ashx"))
             {
                 if (DNTRequest.GetString("t") == "quickreply")
                 {
                     ResponseAjaxVcodeError();
                     return(false);
                 }
             }
             else
             {
                 if ((!(DNTRequest.GetString("loginsubmit") == "true") || !(this.pagename == "login.aspx")) && (!(DNTRequest.GetFormString("agree") == "true") || !(this.pagename == "register.aspx")))
                 {
                     this.AddErrLine("验证码错误");
                     return(false);
                 }
             }
         }
     }
     else
     {
         if (!Online.CheckUserVerifyCode(this.olid, DNTRequest.GetString("vcode")))
         {
             if (this.pagename.EndsWith("ajax.ashx"))
             {
                 ResponseAjaxVcodeError();
                 return(false);
             }
             this.AddErrLine("验证码错误");
             return(false);
         }
     }
     return(true);
 }
Exemple #2
0
        public void VerifyLoginInf()
        {
            if (!Online.CheckUserVerifyCode(this.olid, Request["vcode"]))
            {
                base.Response.Redirect("syslogin.aspx?result=3");
                return;
            }
            User userInfo;

            //if (this.config.Passwordmode == 1)
            //{
            //    userInfo = Users.GetUserInfo(Users.CheckDvBbsPassword(Request["username"], Request["password"]));
            //}
            //else
            //{
            //    if (this.config.Passwordmode == 0)
            //    {
            //userInfo = Users.GetUserInfo(Users.CheckPassword(Request["username"], Utils.MD5(Request["password"]), false));
            userInfo = BBX.Entity.User.Login(Request["username"], Request["password"]);
            //    }
            //    else
            //    {
            //        userInfo = Users.CheckThirdPartPassword(Request["username"], Request["password"], -1, null);
            //    }
            //}
            if (userInfo == null)
            {
                base.Response.Redirect("syslogin.aspx?result=1");
                return;
            }
            var userGroupInfo = UserGroup.FindByID(userInfo.GroupID);

            if (userGroupInfo.Is管理团队)
            {
                ForumUtils.WriteUserCookie(userInfo.ID, 1440, GeneralConfigInfo.Current.Passwordkey);
                var        userGroupInfo2 = UserGroup.FindByID(userInfo.GroupID);
                HttpCookie httpCookie     = new HttpCookie("bbx_admin");
                httpCookie.Values["key"] = ForumUtils.SetCookiePassword(userInfo.Password + userInfo.Secques + userInfo.ID, this.config.Passwordkey);
                httpCookie.Expires       = DateTime.Now.AddMinutes(30.0);
                HttpContext.Current.Response.AppendCookie(httpCookie);
                AdminVisitLog.InsertLog(userInfo.ID, userInfo.Name, userInfo.GroupID, userGroupInfo2.GroupTitle, WebHelper.UserHost, "后台管理员登陆", "");

                //try
                //{
                //    SoftInfo.LoadSoftInfo();
                //}
                //catch
                //{
                //    base.Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>");
                //    base.Response.End();
                //}
                try
                {
                    //GeneralConfigs.Serialiaze(GeneralConfigInfo.Current, base.Server.MapPath("../config/general.config"));
                    GeneralConfigInfo.Current.Save();
                }
                catch
                {
                }
                base.Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>");
                base.Response.End();
                return;
            }
            base.Response.Redirect("syslogin.aspx?result=2");
        }