Example #1
0
 public override bool TakeAction()
 {
     try
     {
         DESAlgorithmNew des = new DESAlgorithmNew();
         password = des.DecodePwd(password, "n7=7=7dk");
         if (password.Length > 12 || password.Length < 4)
         {
             this.ErrorCode = LanguageManager.GetLang().ErrorCode;
             this.ErrorInfo = LanguageManager.GetLang().St1006_PasswordTooLong;
             return(false);
         }
         password = CryptoHelper.DES_Encrypt(password, "5^1-34E!");
         if (SnsManager.ChangePass(Uid, password) <= 0)
         {
             this.ErrorCode = LanguageManager.GetLang().ErrorCode;
             ErrorInfo      = LanguageManager.GetLang().St1006_ChangePasswordError;
             return(false);
         }
     }
     catch (Exception ex)
     {
         this.SaveLog(ex.ToString());
         ErrorCode = LanguageManager.GetLang().ErrorCode;
         ErrorInfo = LanguageManager.GetLang().St1006_PasswordError;
         return(false);
     }
     return(true);
 }
Example #2
0
 public override bool TakeAction()
 {
     try
     {
         DESAlgorithmNew des = new DESAlgorithmNew();
         password = des.DecodePwd(password, GameEnvironment.Setting.ClientDesDeKey);
         if (password.Length > 12 || password.Length < 4)
         {
             this.ErrorCode = Language.Instance.ErrorCode;
             this.ErrorInfo = Language.Instance.St1006_PasswordTooLong;
             return false;
         }
         password = CryptoHelper.DES_Encrypt(password, GameEnvironment.Setting.ProductDesEnKey);
         if (SnsManager.ChangePass(Uid, password) <= 0)
         {
             this.ErrorCode = Language.Instance.ErrorCode;
             ErrorInfo = Language.Instance.St1006_ChangePasswordError;
             return false;
         }
     }
     catch (Exception ex)
     {
         this.SaveLog(ex.ToString());
         ErrorCode = Language.Instance.ErrorCode;
         ErrorInfo = Language.Instance.St1006_PasswordError;
         return false;
     }
     return true;
 }
Example #3
0
 public ResponseData Excute(IMEIInfo data)
 {
     string[] userList = SnsManager.GetRegPassport(data.IMEI);
     return(new PassportInfo()
     {
         PassportId = userList[0], Password = userList[1]
     });
 }
Example #4
0
 public ResponseData Excute(IMEIInfo data)
 {
     if (string.IsNullOrEmpty(data.IMEI))
     {
         throw new HandlerException(StateCode.Error, StateDescription.IMEINullError);
     }
     string[] userList = SnsManager.GetRegPassport(data.IMEI, data.IsNew, EncodePassword);
     return(new PassportInfo()
     {
         PassportId = userList[0], Password = userList[1]
     });
 }
Example #5
0
        public ResponseData Excute(LoginInfo data)
        {
            int    userId;
            int    userType;
            string passportId;

            if (!string.IsNullOrEmpty(data.RetailUser) && !string.IsNullOrEmpty(data.RetailToken))
            {
                ILogin login = LoginProxy.GetLogin(data.RetailID, data);
                login.Password = DecodePassword(login.Password);
                var watch = RunTimeWatch.StartNew("Request login server");
                try
                {
                    if (login.CheckLogin())
                    {
                        watch.Check("GetResponse");
                        userId     = int.Parse(login.UserID);
                        passportId = login.PassportID;
                        userType   = login.UserType;
                    }
                    else
                    {
                        //DoLoginFail();
                        throw new HandlerException(StateCode.Error, StateDescription.PassworkError);
                    }
                }
                finally
                {
                    watch.Flush(true, 100);
                }
            }
            else
            {
                if (string.IsNullOrEmpty(data.Pwd) || data.Pwd.Length < 5)
                {
                    throw new HandlerException(StateCode.Error, StateDescription.PassworkLengthError);
                }
                data.Pwd = DecodePassword(data.Pwd);
                //快速登录
                RegType regType;
                userId = SnsManager.LoginByDevice(data.Pid, data.Pwd, data.DeviceID, out regType, data.IsCustom);
                if (userId <= 0)
                {
                    throw new HandlerException(StateCode.PassworkError, StateDescription.PassworkError);
                }
                passportId = data.Pid;
                userType   = (int)regType;
            }

            return(AuthorizeLogin(userId, passportId, userType));
        }
Example #6
0
        public ResponseData Excute(LoginInfo data)
        {
            if (string.IsNullOrEmpty(data.Pid) || string.IsNullOrEmpty(data.Pwd))
            {
                throw new HandlerException(StateCode.Error, StateDescription.PasswordOrPassError);
            }
            data.Pwd = DecodePassword(data.Pwd);
            int userId = SnsManager.QuickRegisterPassport(data.Pid, data.Pwd, data.DeviceID, data.IsCustom);

            if (userId <= 0)
            {
                throw new HandlerException(StateCode.Error, StateDescription.RegistError);
            }
            return(AuthorizeLogin(userId, data.Pid));
        }
Example #7
0
        public ResponseData Excute(PassportInfo data)
        {
            if (string.IsNullOrEmpty(data.PassportId) || string.IsNullOrEmpty(data.Password))
            {
                throw new HandlerException(StateCode.Error, StateDescription.PasswordOrPassError);
            }
            data.Password = DecodePassword(data.Password);
            int result = SnsManager.ChangePass(data.PassportId, data.Password);

            if (result <= 0)
            {
                throw new HandlerException(StateCode.Error, StateDescription.ChangePassError);
            }
            return(new ResponseData());
        }
Example #8
0
        public override bool TakeAction()
        {
            try
            {
                DESAlgorithmNew des = new DESAlgorithmNew();
                password = des.DecodePwd(password, GameEnvironment.Setting.ClientDesDeKey);
                if (password.Length > 12 || password.Length < 4)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St1006_PasswordTooLong;
                    return(false);
                }
                Regex re = new Regex(@"^[\u4e00-\u9fa5\w]+$");
                if (!re.IsMatch(password))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1006_PasswordExceptional;
                    return(false);
                }
                password = CryptoHelper.DES_Encrypt(password, GameEnvironment.Setting.ProductDesEnKey);
                if (SnsManager.ChangePass(Uid, password) <= 0)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo      = LanguageManager.GetLang().St1006_ChangePasswordError;
                    return(false);
                }
                else
                {
                    UserOperationLog userOperationLog = new UserOperationLog();
                    userOperationLog.UserID     = ContextUser.UserID;
                    userOperationLog.ActionID   = ActionIDDefine.Cst_Action1006;
                    userOperationLog.FunctionID = "更新密码";
                    userOperationLog.CreateDate = DateTime.Now;
                    userOperationLog.Num        = 0;

                    var sender = DataSyncManager.GetDataSender();
                    sender.Send(userOperationLog);
                }
            }
            catch (Exception ex)
            {
                this.SaveLog(ex.ToString());
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1006_PasswordError;
                return(false);
            }
            return(true);
        }
Example #9
0
 public override bool TakeAction()
 {
     try
     {
         string[] userList = SnsManager.GetRegPassport(deviceID);
         passport = userList[0];
         password = CryptoHelper.DES_Decrypt(userList[1], GameEnvironment.ProductDesEnKey);
         return(true);
     }
     catch (Exception ex)
     {
         this.SaveLog(ex);
         this.ErrorCode = LanguageManager.GetLang().ErrorCode;
         this.ErrorInfo = LanguageManager.GetLang().St1002_GetRegisterPassportIDError;
         return(false);
     }
 }
Example #10
0
        /// <summary>
        /// 业务逻辑处理
        /// </summary>
        /// <returns>false:中断后面的方式执行并返回Error</returns>
        public override bool TakeAction()
        {
            try
            {
                Console.WriteLine("_deviceID:" + _deviceID);
                string[] userList = SnsManager.GetRegPassport(_deviceID);
                _passportID = userList[0];
                _password   = userList[1];
                return(true);
            }
            catch (Exception ex)
            {
                this.SaveLog(ex);

                return(false);
            }
        }
Example #11
0
 public override bool TakeAction()
 {
     try
     {
         string[] userList = SnsManager.GetRegPassport(deviceID);
         passport = userList[0];
         password = userList[1];
         return(true);
     }
     catch (Exception ex)
     {
         this.SaveLog(ex);
         this.ErrorCode = Language.Instance.ErrorCode;
         this.ErrorInfo = Language.Instance.St1002_GetRegisterPassportIDError;
         return(false);
     }
 }
Example #12
0
 /// <summary>
 /// 业务逻辑处理
 /// </summary>
 /// <returns>false:中断后面的方式执行并返回Error</returns>
 public override bool TakeAction()
 {
     responsePack = new ResponseRegister1002Pack();
     try
     {
         string[] userList = SnsManager.GetRegPassport(requestPack.DeviceID);
         responsePack.passport = userList[0];
         responsePack.password = userList[1];
         return(true);
     }
     catch (Exception ex)
     {
         this.SaveLog(ex);
         this.ErrorCode = ZyGames.Framework.Game.Lang.Language.Instance.ErrorCode;
         this.ErrorInfo = ZyGames.Framework.Game.Lang.Language.Instance.St1002_GetRegisterPassportIDError;
         return(false);
     }
 }
Example #13
0
        public ResponseData Excute(LoginInfo data)
        {
            if (string.IsNullOrEmpty(data.Pwd) || data.Pwd.Length < 5)
            {
                throw new HandlerException(StateCode.Error, StateDescription.PassworkLengthError);
            }
            if (data.Pwd.Length > 32)
            {
                data.Pwd = DecodePassword(data.Pwd);
            }
            //快速登录
            var userId = SnsManager.LoginByDevice(data.Pid, data.Pwd, data.IMEI);

            if (userId <= 0)
            {
                throw new HandlerException(StateCode.PassworkError, StateDescription.PassworkError);
            }
            return(AuthorizeLogin(userId, data.Pid));
        }
Example #14
0
        /// <summary>
        /// 业务逻辑处理
        /// </summary>
        /// <returns>false:中断后面的方式执行并返回Error</returns>
        public override bool TakeAction()
        {
            //Console.WriteLine(SnsManager.RegisterPassport(_password));
            //_relu = SnsManager.QuickRegisterPassport(_account, _password);
            //_relu = 1;
            //Console.WriteLine(SnsManager.CheckPassport(_account));
            //SnsManager.RegisterPassportTest(_account, _password);
            if (SnsManager.Register(_account, _password, ""))
            {
                _relu = 0;
                Console.WriteLine("注册成功 账号:{0}  密码:{1}", _account, _password);
            }
            else
            {
                Console.WriteLine("注册失败");
                _relu = 1;
            }

            return(true);
        }
Example #15
0
        /// <summary>
        /// 子类实现Action处理
        /// </summary>
        /// <returns></returns>
        public override bool TakeAction()
        {
            ILogin login = LoginProxy.GetLogin();

            if (login != null && login.CheckLogin())
            {
                Uid        = login.UserID;
                Sid        = Current.SessionId;
                UserId     = Uid.ToInt();
                PassportId = login.PassportID;
                var session = GameSession.Get(Sid);
                if (session != null)
                {
                    session.BindIdentity(UserId);
                }
                UserType = SnsManager.GetUserType(PassportId);
                SetParameter(login);
                if (!GetError() && DoSuccess(UserId))
                {
                    if (UserFactory != null)
                    {
                        var user = UserFactory(UserId);
                        if (user != null)
                        {
                            Current.User       = user;
                            user.RemoteAddress = httpGet.RemoteAddress;
                        }
                    }
                    return(true);
                }
            }
            else
            {
                Uid       = string.Empty;
                Sid       = string.Empty;
                ErrorCode = Language.Instance.ErrorCode;
                ErrorInfo = Language.Instance.PasswordError;
            }
            return(false);
        }
Example #16
0
        public override bool TakeAction()
        {
            ILogin login = LoginProxy.GetLogin();

            if (login != null && login.CheckLogin())
            {
                Uid        = login.UserID;
                Sid        = httpGet.SessionId;//string.Format("{0}|{1}|{2}", login.SessionID, GameType, ServerID);
                UserId     = Uid.ToInt();
                PassportId = login.PassportID;
                UserType   = SnsManager.GetUserType(PassportId);
                SetParameter(login);
                InitContext(actionId, UserId);
                using (RequestLock())
                {
                    if (!GetError() && DoSuccess(UserId))
                    {
                        if (UserFactory != null)
                        {
                            var user = UserFactory(UserId);
                            if (user != null)
                            {
                                user.RemoteAddress = httpGet.RemoteAddress;
                                user.SocketSid     = httpGet.SessionId;
                                httpGet.LoginSuccessCallback(UserId);
                            }
                        }
                        return(true);
                    }
                }
            }
            else
            {
                Uid       = string.Empty;
                Sid       = string.Empty;
                ErrorCode = LanguageHelper.GetLang().ErrorCode;
                ErrorInfo = LanguageHelper.GetLang().PasswordError;
            }
            return(false);
        }
Example #17
0
 /// <summary>
 /// 业务逻辑处理
 /// </summary>
 /// <returns>false:中断后面的方式执行并返回Error</returns>
 public override bool TakeAction()
 {
     try
     {
         if (_openid != "")
         {
             var     q      = SnsManager.Register(_openid, "123456", "", true);
             var     s      = SnsManager.RegisterWeixin(_openid, "123456", "", _openid);
             SnsUser _tempu = SnsManager.LoginByWeixin(_openid);
             passport          = _tempu.PassportId;
             password          = _tempu.Password;
             _tempu.RetailUser = _openid;
             _tempu.RetailID   = retailID;
             _tempu.WeixinCode = _openid;
             SnsManager.ChangeUserInfo(passport, _tempu);
         }
         else
         {
             string[] userList = SnsManager.GetRegPassport(deviceID);
             passport = userList[0];
             password = userList[1];
         }
         sc_device _scd = new sc_device()
         {
             fn = "sc_device", result = 1
         };
         _scd.passportid = passport;
         _scd.password   = password;
         _senddata       = JsonUtils.Serialize(_scd);
         return(true);
     }
     catch (Exception ex)
     {
         this.SaveLog(ex);
         this.ErrorCode = Language.Instance.ErrorCode;
         this.ErrorInfo = Language.Instance.St1002_GetRegisterPassportIDError;
         return(false);
     }
 }
Example #18
0
 /// <summary>
 /// 业务逻辑处理
 /// </summary>
 /// <returns>false:中断后面的方式执行并返回Error</returns>
 public override bool TakeAction()
 {
     try
     {
         string  _pid      = "";
         bool    _isExiste = false;
         SnsUser _snsuser  = SnsManager.LoginByWeixin(_openid);
         if (string.IsNullOrEmpty(_snsuser.WeixinCode))
         {//注册绑定
             ////var q = SnsManager.Register(_openid, "123456", "", true);
             ////var s = SnsManager.RegisterWeixin(_openid, "123456", "", _openid);
             ////SnsUser _tempu = SnsManager.LoginByWeixin(_openid);
             ////_pid = _tempu.PassportId;
             ////_userid = _tempu.UserId;
         }
         else
         {
             _isExiste = true;
             _pid      = _snsuser.PassportId;
             ////_userid = _snsuser.UserId;
         }
         sc_getexiste_openid _scd = new sc_getexiste_openid()
         {
             fn = "sc_getexiste_openid", result = 1
         };
         _scd._existe = _isExiste;  //------------------------------
         _scd._pid    = _pid;
         _senddata    = JsonUtils.Serialize(_scd);
         return(true);
     }
     catch (Exception ex)
     {
         ErrorRecord.Record("20170216 验证帐号时就不对了");
         this.SaveLog(ex);
         this.ErrorCode = 10086;
         return(false);
     }
 }
Example #19
0
        public static string getRetailID(string passportID)
        {
            SnsUser user = SnsManager.GetUserInfo(passportID);

            return(user == null ? "0000" : user.RetailID);
        }