Example #1
0
        /// <summary>
        /// 校验登录密码
        /// </summary>
        /// <param name="strLoginName"></param>
        /// <param name="strPassword"></param>
        /// <returns></returns>
        public static bool VerifyLogin(string strLoginName, string strPassword)
        {
            _IsVerifySuccess = false;
            bool      bolIsLogin = false;
            DataTable dtUser     = GetUserInfo(strLoginName);

            if (dtUser.Rows.Count == 0)
            {
                throw new Exception("该用户名称不存在!");
            }
            else
            {
                string strUserPassword = dtUser.Rows[0]["UserPassword"].ToString().TrimEnd();
                int    iUserID         = Convert.ToInt32(dtUser.Rows[0]["UserID"]);
                int    iUserType       = Convert.ToInt32(dtUser.Rows[0]["UserType"]);
                //string strImputPassword = LBEncrypt.DESEncrypt(strPassword, "linrubin");
                if (LBEncrypt.DESEncrypt(strPassword, "linrubin") == strUserPassword)
                {
                    bolIsLogin       = true;
                    _UserID          = iUserID;
                    _IsVerifySuccess = true;
                    _LoginName       = strLoginName;
                    _LoginTime       = DateTime.Now;
                    _IsVerifySuccess = true;
                    _UserType        = iUserType;
                }
                else
                {
                    throw new Exception("密码不正确,请重新输入!");
                }
            }

            return(bolIsLogin);
        }
Example #2
0
        /// <summary>
        /// 校验密码是否正确
        /// </summary>
        /// <param name="strLoginName"></param>
        /// <param name="strPassword"></param>
        /// <returns></returns>
        public static bool VerifyPassword(int iUserID, string strPassword)
        {
            bool      bolIsVerify = false;
            DataTable dtUser      = GetUserInfo(iUserID);

            if (dtUser.Rows.Count == 0)
            {
                throw new Exception("该用户名称不存在!");
            }
            string strUserPassword = dtUser.Rows[0]["UserPassword"].ToString().TrimEnd();

            if (LBEncrypt.DESEncrypt(strPassword, "linrubin") == strUserPassword)
            {
                bolIsVerify = true;
            }
            return(bolIsVerify);
        }
Example #3
0
 /// <summary>
 /// 加密密码
 /// </summary>
 /// <param name="strPassword"></param>
 /// <returns></returns>
 public static string EncryptPassword(string strPassword)
 {
     return(LBEncrypt.DESEncrypt(strPassword, "linrubin"));
 }