コード例 #1
0
ファイル: AccountManager.cs プロジェクト: wovencode/OldMMO
        // -------------------------------------------------------------------------------
        // ReqAccountChangePassword
        // -------------------------------------------------------------------------------
        public MsgAckAccountChangePassword ReqAccountChangePassword(MsgReqAccountChangePassword message, NetworkConnection connection = null)
        {
            int      _nResult = confirmAccountChangePassword ? Constants.INT_CONFIRM : Constants.INT_FAILURE;
            CAccount cAccount = null;

            if (dictLobby.TryGetValue(connection, out cAccount))
            {
                if (passwordManager.VerifyPassword(message.sOldPassword, cAccount.sPassword))
                {
                    if (confirmAccountChangePassword && !cAccount.IsDone)
                    {
                        RequestSecurityCode(cAccount, Constants.AccountActionType.ChangePassword);
                    }
                    else
                    {
                        cAccount.sPassword = passwordManager.CreateHash(message.sNewPassword);
                        _nResult           = AccountUpdate(cAccount, connection) ? Constants.INT_SUCCESS : _nResult;
                    }
                }
                else
                {
                    _nResult = Constants.INT_FAILURE;
                }
            }

            return(new MsgAckAccountChangePassword {
                nResult = _nResult
            });
        }
コード例 #2
0
ファイル: ClientManager.cs プロジェクト: wovencode/OldMMO
        // -------------------------------------------------------------------------------
        // ReqAccountChangePassword
        // -------------------------------------------------------------------------------
        public void ReqAccountChangePassword(string[] fields, Action <string[]> callbackFunction)
        {
            DictionaryAddAction(callbackFunction);

            MsgReqAccountChangePassword message = new MsgReqAccountChangePassword {
                sOldPassword = Tools.HashPassword(fields[0]),
                sNewPassword = Tools.HashPassword(fields[1])
            };

            networkManager.client.Send(MsgReqAccountChangePassword.nId, message);
        }
コード例 #3
0
        // -------------------------------------------------------------------------------
        // OnReqAccountChangePassword
        // -------------------------------------------------------------------------------
        public void OnReqAccountChangePassword(NetworkMessage networkMessage)
        {
            MsgReqAccountChangePassword message = networkMessage.ReadMessage <MsgReqAccountChangePassword>();

            networkMessage.conn.Send(MsgAckAccountChangePassword.nId, accountManager.ReqAccountChangePassword(message, networkMessage.conn));
        }