您的位置:首页 > 其它

用户登录错误3次锁定10分钟

2010-04-22 15:09 218 查看
        public bool UserLogin(string userName, string password) {

            MemberInfo member = null;

            member =
dao.GetModel(userName);

            // 不存在该会员

            if
(member.LoginTimes >= 5)

            {

                if
(member.LastLoginDate.AddMinutes(10) > DateTime.Now)

               
{

                    throw new
Exception("错误次数过多,请10分钟后再试!");

                }

               
else

                {

                    member.LoginTimes =
0;

                }

            }

            if(member == null)
{

                throw new Exception("不存在该会员!");

           
}

            if(member.State != EUserState.Normal.ToString())
{

                throw new Exception("该会员帐号暂时不能用!!");

            }

            if(member.Password != password)

           
{

                throw new Exception("密码不对!!");

               
member.LastLoginDate = DateTime.Now;

                member.LoginTimes +=
1;

            }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  exception string null