// ------------------------------------------------------------------------------- // 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 }); }
// ------------------------------------------------------------------------------- // 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); }
// ------------------------------------------------------------------------------- // OnReqAccountChangePassword // ------------------------------------------------------------------------------- public void OnReqAccountChangePassword(NetworkMessage networkMessage) { MsgReqAccountChangePassword message = networkMessage.ReadMessage <MsgReqAccountChangePassword>(); networkMessage.conn.Send(MsgAckAccountChangePassword.nId, accountManager.ReqAccountChangePassword(message, networkMessage.conn)); }