Exemple #1
0
        public string ChangePassword(string userId)
        {
            var r                      = new Random(DateTime.Now.Millisecond);
            var password               = r.Next(100000, 999999).ToString();
            var encodePassword         = Encipherment.MD5(string.Format("{0}{1}", password, _gbKey)).ToUpper();
            var password_balance       = r.Next(100000, 999999).ToString();
            var encodePassword_balance = Encipherment.MD5(string.Format("{0}{1}", password_balance, _gbKey)).ToUpper();

            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();

                var loginManager = new LoginLocalManager();
                var user         = loginManager.GetLoginByUserId(userId);
                if (user == null)
                {
                    throw new AuthException("用户不存在或不是本地注册用户,不能修改密码。请确定是否是通过支付宝或QQ帐号进行登录,如有疑问,请联系客服。");
                }
                user.Password = encodePassword;
                loginManager.UpdateLogin(user);

                var balanceManage = new UserBalanceManager();
                var b             = balanceManage.QueryUserBalance(userId);
                b.Password = encodePassword_balance;
                balanceManage.UpdateUserBalance(b);

                biz.CommitTran();
            }
            return(string.Format("{0}|{1}", password, password_balance));
        }
Exemple #2
0
        public string ResetUserBalancePwd(string userId)
        {
            var newPwd = string.Empty;

            //开启事务
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager = new UserMobileManager();
                //var entity = manager.GetUserMobile(userId);
                //if (entity == null)
                //    throw new ArgumentException("此用户从未进行过手机认证");
                //if (entity.Mobile != mobileNumber)
                //    throw new ArgumentException("用户认证的手机号码不正确");

                var balanceManager = new UserBalanceManager();
                var balance        = balanceManager.QueryUserBalance(userId);
                if (balance == null)
                {
                    throw new ArgumentException("用户资金信息查询出错");
                }

                balance.Password = Encipherment.MD5(string.Format("{0}{1}", C_DefaultPassword, _gbKey)).ToUpper();
                balanceManager.UpdateUserBalance(balance);

                biz.CommitTran();
            }
            return(newPwd);
        }
Exemple #3
0
        public void SetBalancePassword(string userId, string oldPassword, bool isSetPwd, string newPassword)
        {
            var balanceManager = new UserBalanceManager();
            var entity         = balanceManager.QueryUserBalance(userId);

            if (entity.IsSetPwd)
            {
                oldPassword = Encipherment.MD5(string.Format("{0}{1}", oldPassword, _gbKey)).ToUpper();
                if (string.IsNullOrEmpty(oldPassword) || !oldPassword.Equals(entity.Password))
                {
                    throw new Exception("输入资金密码错误");
                }
            }
            entity.IsSetPwd = isSetPwd;
            entity.Password = Encipherment.MD5(string.Format("{0}{1}", newPassword, _gbKey)).ToUpper();
            balanceManager.UpdateUserBalance(entity);
        }
Exemple #4
0
        public void AdminResetUserBalancePwd(string userId, string pwd)
        {
            //开启事务
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var balanceManager = new UserBalanceManager();
                var balance        = balanceManager.QueryUserBalance(userId);
                if (balance == null)
                {
                    throw new ArgumentException("用户资金信息查询出错");
                }

                balance.Password = Encipherment.MD5(pwd);
                balanceManager.UpdateUserBalance(balance);

                biz.CommitTran();
            }
        }
Exemple #5
0
        public void SetBalancePasswordNeedPlace(string userId, string password, string placeList)
        {
            var balanceManager = new UserBalanceManager();
            var entity         = balanceManager.QueryUserBalance(userId);

            if (entity.IsSetPwd)
            {
                password = Encipherment.MD5(string.Format("{0}{1}", password, _gbKey)).ToUpper();
                if (string.IsNullOrEmpty(password) || !password.Equals(entity.Password))
                {
                    throw new Exception("输入资金密码错误");
                }
            }
            else
            {
                throw new Exception("必须先设置资金密码");
            }
            entity.NeedPwdPlace = placeList;
            balanceManager.UpdateUserBalance(entity);
        }