示例#1
0
        /// <summary>
        /// 验证登录初始化
        /// </summary>
        private void CheckLogin()
        {
            string UserName = Tools.GetForm("UserName");
            string Password = Tools.GetForm("Password");

            if (UserName == string.Empty || Password == string.Empty)
            {
                Response.Write(Convert.ToInt32(LoginState.Err_Format).ToString());
            }
            else
            {
                UserInfo ShopUser = new UserInfo();
                ShopUser.UserName      = UserName;
                ShopUser.Password      = Tools.MD5(Password);
                ShopUser.LastLoginTime = DateTime.Now;
                ShopUser.LastLoginIP   = Tools.GetIP();

                LoginState ls = new BLL.City.Shop.User().CheckLogin(ShopUser);
                if (ls == LoginState.Succeed)
                {
                    Session.Add("ShopUser", ShopUser);
                }
                Response.Write(Convert.ToInt32(ls).ToString());
            }
            Response.End();
        }
示例#2
0
 /// <summary>
 /// 检查邮箱
 /// </summary>
 /// <returns></returns>
 private bool CheckEmail()
 {
     Email = Tools.GetForm("Email").ToLower();
     if (Email == string.Empty)
     {
         ShowWindow(4, "系统提示", "请填写邮箱", null, true);
         return(false);
     }
     else
     {
         if (Regex.IsMatch(Email, @"^[\w\.-]+@[\w\.-]+\.\w+$"))
         {
             bool Result = false;
             if (RegisterShop)
             {
                 Result = new BLL.City.Shop.User().CheckEmailIsExist(Email);
             }
             else
             {
                 Result = new BLL.Core.Member.User().CheckEmailIsExist(Email);
             }
             if (Result)
             {
                 ShowWindow(4, "系统提示", "此邮箱已被使用,换个其它的吧", null, true);
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
         else
         {
             ShowWindow(4, "系统提示", "邮箱地址无效", null, true);
             return(false);
         }
     }
 }
示例#3
0
 /// <summary>
 /// 检查注册/添加用户
 /// </summary>
 private void CheckRegister()
 {
     if (CheckUserName() && CheckPassword() && CheckConfirmPassword() && CheckEmail() && CheckValidateCode())
     {
         int    Result = 0;
         string msg    = "";
         string url    = "";
         if (RegisterShop)
         {
             TL.Model.City.Shop.UserInfo NewShopUser = new TL.Model.City.Shop.UserInfo();
             NewShopUser.UserName = UserName;
             NewShopUser.Password = Tools.MD5(Password);
             NewShopUser.Email    = Email;
             Result = new BLL.City.Shop.User().Add(NewShopUser);
             msg    = "您已成功注册为 \\\"" + S.SiteName + "\\\" 的店铺用户";
             url    = "myshop/login.aspx";
         }
         else
         {
             TL.Model.Core.Member.UserInfo NewMemberUser = new TL.Model.Core.Member.UserInfo();
             NewMemberUser.UserName = UserName;
             NewMemberUser.Password = Tools.MD5(Password);
             NewMemberUser.Email    = Email;
             Result = new BLL.Core.Member.User().Add(NewMemberUser);
             msg    = "您已成功注册为 \\\"" + S.SiteName + "\\\" 的会员用户";
             url    = "login.aspx";
         }
         if (Result != 0)
         {
             ShowWindow(3, "注册成功", msg, url, false);
             TL.Common.ValidateImage.ClearCode();
         }
         else
         {
             ShowWindow(4, "系统提示", "注册失败", null, true);
         }
     }
 }
示例#4
0
 /// <summary>
 /// 检查用户名
 /// </summary>
 /// <returns></returns>
 private bool CheckUserName()
 {
     UserName = Tools.GetForm("UserName").ToLower();
     if (UserName == string.Empty)
     {
         ShowWindow(4, "系统提示", "请填写用户名", null, true);
         return(false);
     }
     else
     {
         if (Regex.IsMatch(UserName, @"^[a-zA-Z0-9_]{4,16}$"))
         {
             bool Result = false;
             if (RegisterShop)
             {
                 Result = new BLL.City.Shop.User().CheckUserNameIsExist(UserName);
             }
             else
             {
                 Result = new BLL.Core.Member.User().CheckUserNameIsExist(UserName);
             }
             if (Result)
             {
                 ShowWindow(4, "系统提示", "此用户名已被使用,换个其它的吧", null, true);
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
         else
         {
             ShowWindow(4, "系统提示", "用户名格式错误", null, true);
             return(false);
         }
     }
 }