Ejemplo n.º 1
0
        // -------------------------------------------------------------------------------
        // 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
            });
        }
Ejemplo n.º 2
0
        // -------------------------------------------------------------------------------
        // 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);
        }
Ejemplo n.º 3
0
        // -------------------------------------------------------------------------------
        // OnReqAccountChangePassword
        // -------------------------------------------------------------------------------
        public void OnReqAccountChangePassword(NetworkMessage networkMessage)
        {
            MsgReqAccountChangePassword message = networkMessage.ReadMessage <MsgReqAccountChangePassword>();

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