
Gestión de Cambios de Contraseña en MuOnline: Seguridad
Introducción
En el mundo de MuOnline, la seguridad de las cuentas de los jugadores es fundamental. Implementar un sistema eficiente para el cambio de contraseñas no solo mejora la experiencia del usuario, sino que también protege sus datos personales. A continuación, exploraremos cómo se puede gestionar este proceso a través del código.
- Inclusiones de Archivos:
- Se importan archivos necesarios para la funcionalidad del sistema, como definiciones de interfaz y protocolos de usuario.
- Definición de Variables Globales:
- Se declara una instancia de la clase
QUAN_LY_TK, que maneja la lógica de gestión de cuentas.
- Se declara una instancia de la clase
- Constructor de la Clase:
- El constructor inicializa la clase, preparando el sistema para su uso.
- Método para Dibujar la Ventana:
- Se encarga de mostrar la interfaz gráfica para cambiar la contraseña.
- Manejo de Eventos de Clic:
- Gestiona las interacciones del usuario, como clics en botones para aceptar o cerrar la ventana.
- Manejo de Entradas de Texto:
- Permite a los usuarios ingresar su contraseña antigua y nueva, asegurando una experiencia fluida.
Conclusión
Implementar un sistema de gestión de cambios de contraseña en MuOnline no solo mejora la seguridad, sino que también optimiza la experiencia del usuario. A través de una interfaz intuitiva y un código bien estructurado, los jugadores pueden gestionar sus cuentas de manera efectiva.
- Inclusiones de Archivos:
#include "stdafx.h"
#include "QuanLyTaiKhoan.h"
#include "CustomMessage.h"
#include "Defines.h"
#include "Interface.h"
#include "User.h"
#include "Protocol.h"
#include "PrintPlayer.h"
#include "SItemOption.h"
#include "Import.h"
#include "Central.h"
- Estas líneas importan otros archivos de encabezado necesarios para el funcionamiento del módulo. Incluyen definiciones de interfaz, mensajes personalizados y funciones relacionadas con el usuario.
- Definición de Variables Globales:
cpp
CopiarQUAN_LY_TK G_QUAN_LY_TK;
- Aquí se declara una instancia global de la clase
QUAN_LY_TK, que probablemente maneja la lógica de gestión de cuentas.
- Aquí se declara una instancia global de la clase
- Definición de Constantes:
#define MAX_TRANG_QUAN_LY 10
- Se define una constante que podría indicar el número máximo de páginas o ventanas de gestión de cuentas.
- Constructor de la Clase:
cpp
CopiarQUAN_LY_TK::QUAN_LY_TK()
{
}
- Este es el constructor de la clase
QUAN_LY_TK, que se ejecuta cuando se crea una instancia de la clase.
- Este es el constructor de la clase
- Método para Dibujar la Ventana:
cpp
Copiarvoid QUAN_LY_TK::DRAW_QUAN_LY()
{
DRAW_WINDOW_CHANGEPASS();
}
- Este método se encarga de dibujar la ventana para cambiar la contraseña.
- Método para Vincular Objetos de la Interfaz:
cpp
Copiarvoid QUAN_LY_TK::BinObeject()
{
gInterface.BindObject(eChangePass_Main, 31461, 640, 419, -1, -1);
// Otros objetos de la interfaz...
}
- Este método vincula diferentes elementos de la interfaz gráfica del usuario (GUI) a sus respectivas funciones o identificadores.
- Manejo de Eventos de Clic:
cpp
Copiarbool QUAN_LY_TK::EVENT_CLICK_CHANGEPASS(DWORD Event)
{
// Lógica para manejar clics en los botones de cambiar contraseña.
}
- Este método gestiona los eventos de clic en los botones de la ventana de cambio de contraseña. Se encarga de verificar si el usuario ha hecho clic en el botón de cerrar o en el botón de aceptar.
- Manejo de Entradas de Texto:
cpp
Copiarbool QUAN_LY_TK::CHANGEPASS_TEXTBOX(DWORD Event)
{
// Lógica para manejar la entrada de texto en los campos de contraseña.
}
- Este método gestiona las entradas de texto en los campos de contraseña, permitiendo al usuario ingresar su contraseña antigua y nueva, así como manejar acciones como borrar o presionar «Enter».
- Dibujo de la Ventana de Cambio de Contraseña:
cpp
Copiarvoid QUAN_LY_TK::DRAW_WINDOW_CHANGEPASS()
{
// Lógica para dibujar la ventana de cambio de contraseña.
}
- Este método se encarga de dibujar la ventana que permite a los usuarios cambiar su contraseña, incluyendo la posición y el tamaño de los elementos de la interfaz.
Resumen
En resumen, este código forma parte de un sistema para gestionar el cambio de contraseñas en un juego. Permite a los usuarios introducir su contraseña antigua y nueva, y maneja la lógica para enviar estos datos al servidor. También incluye la gestión de la interfaz gráfica, asegurándose de que los elementos estén correctamente vinculados y visibles para el usuario.
Stdafx.h
#define QuanLy_TaiKhoan 1
Controller.cpp
#if(QuanLy_TaiKhoan) #include "QuanLyTaiKhoan.h" #endif
Busca case WM_LBUTTONDOWN: y Agregar
#if(QuanLy_TaiKhoan)
G_QUAN_LY_TK.EVENT_CLICK_CHANGEPASS(wParam);
#endif
Interface.cpp
#if(QuanLy_TaiKhoan) #include "QuanLyTaiKhoan.h" #endif
Buscar this->BindObject( y agregar abajo de esos codigos
#if(QuanLy_TaiKhoan)
G_QUAN_LY_TK.BinObeject();
#endif
Agregar debajo void Interface::Work() Este codigo
#if(QuanLy_TaiKhoan)
G_QUAN_LY_TK.DRAW_QUAN_LY();
#endif
Agregar debajo de if (GetKeyState(
#if(QuanLy_TaiKhoan)
if (GetKeyState(VK_F5) & 0x4000)
{
G_QUAN_LY_TK.OPEN_WINDOW_CHANGEPASS();
}
#endif
QuanLyTaiKhoan.cpp
#include "stdafx.h"
#if(QuanLy_TaiKhoan)
//-----------------------------------------------------------------------------------------------------------------------------------------------------
#include "QuanLyTaiKhoan.h"
//-----------------------------------------------------------------------------------------------------------------------------------------------------
#include "CustomMessage.h"
#include "Defines.h"
//-----------------------------------------------------------------------------------------------------------------------------------------------------
#include "Interface.h"
#include "User.h"
#include "Protocol.h"
#include "PrintPlayer.h"
#include "SItemOption.h"
#include "Import.h"
#include "Central.h"
//-----------------------------------------------------------------------------------------------------------------------------------------------------
QUAN_LY_TK G_QUAN_LY_TK;
//-----------------------------------------------------------------------------------------------------------------------------------------------------
#define MAX_TRANG_QUAN_LY 10 // OK
//-----------------------------------------------------------------------------------------------------------------------------------------------------
QUAN_LY_TK::QUAN_LY_TK()
{
//-----------------------------------------------------------------------------------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
void QUAN_LY_TK::DRAW_QUAN_LY()
{
DRAW_WINDOW_CHANGEPASS();
}
void QUAN_LY_TK::BinObeject()
{
gInterface.BindObject(eChangePass_Main, 31461, 640, 419, -1, -1); // 31461
gInterface.BindObject(eChangePass_BTCLOSE, 0x7EC5, 36, 29, -1, -1);
gInterface.BindObject(eChangePass_OLD, 0x7AA3, 170, 21, -1, -1);
gInterface.BindObject(eChangePass_NEW, 0x7AA3, 170, 21, -1, -1);
gInterface.BindObject(eChangePass_BTOK, 0x7A5B, 54, 30, -1, -1);
}
void QUAN_LY_TK::LoadImages()
{
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------------------------------
bool QUAN_LY_TK::EVENT_CLICK_CHANGEPASS(DWORD Event)
{
DWORD CurrentTick = GetTickCount();
DWORD Delay = (CurrentTick - gInterface.Data[eChangePass_BTCLOSE].EventTick);
DWORD Delay_2 = (CurrentTick - gInterface.Data[eChangePass_BTOK].EventTick);
// ----
if (!gInterface.Data[eChangePass_Main].OnShow)
{
return false;
}
if (gInterface.IsWorkZone(eChangePass_OLD))
{
gInterface.Data[eChangePass_OLD].Attribute = 1;
}
else
{
gInterface.Data[eChangePass_OLD].Attribute = 0;
}
if (gInterface.IsWorkZone(eChangePass_NEW))
{
gInterface.Data[eChangePass_NEW].Attribute = 1;
}
else
{
gInterface.Data[eChangePass_NEW].Attribute = 0;
}
if (gInterface.IsWorkZone(eChangePass_BTCLOSE))
{
// ----
if (Event == WM_LBUTTONDOWN)
{
gInterface.Data[eChangePass_BTCLOSE].OnClick = true;
return true;
}
// ----
gInterface.Data[eChangePass_BTCLOSE].OnClick = false;
// ----
if (Delay < 500)
{
return false;
}
// ----
gInterface.Data[eChangePass_BTCLOSE].EventTick = GetTickCount();
G_QUAN_LY_TK.OPEN_WINDOW_CHANGEPASS();
sprintf(gInterface.Data[eChangePass_OLD].StatValue, ""); //NONE
sprintf(gInterface.Data[eChangePass_OLD_HIDE].StatValue, ""); //NONE
sprintf(gInterface.Data[eChangePass_NEW].StatValue, ""); //NONE
sprintf(gInterface.Data[eChangePass_NEW_HIDE].StatValue, ""); //NONE
}
else if (gInterface.IsWorkZone(eChangePass_BTOK))
{
// ----
if (Event == WM_LBUTTONDOWN)
{
gInterface.Data[eChangePass_BTOK].OnClick = true;
return true;
}
// ----
gInterface.Data[eChangePass_BTOK].OnClick = false;
// ----
if (Delay_2 < 500)
{
return false;
}
// ----
gInterface.Data[eChangePass_BTOK].EventTick = GetTickCount();
//=== SEND GS
CSENDGS_DOIMK pMsg;
pMsg.TYPE = 0x01;
memcpy(pMsg.PASS_OLD, gInterface.Data[eChangePass_OLD].StatValue, sizeof(pMsg.PASS_OLD));
memcpy(pMsg.PASS_NEW, gInterface.Data[eChangePass_NEW].StatValue, sizeof(pMsg.PASS_NEW));
pMsg.Head.set(0xFF, 0x91, sizeof(pMsg));
DataSend((BYTE*)&pMsg, pMsg.Head.size);
//===========
G_QUAN_LY_TK.OPEN_WINDOW_CHANGEPASS();
sprintf(gInterface.Data[eChangePass_OLD].StatValue, ""); //NONE
sprintf(gInterface.Data[eChangePass_OLD_HIDE].StatValue, ""); //NONE
sprintf(gInterface.Data[eChangePass_NEW].StatValue, ""); //NONE
sprintf(gInterface.Data[eChangePass_NEW_HIDE].StatValue, ""); //NONE
}
// ----
return false;
}
#include "Util.h"
bool QUAN_LY_TK::CHANGEPASS_TEXTBOX(DWORD Event)
{
if (gInterface.Data[eChangePass_Main].OnShow && gInterface.Data[eChangePass_OLD].Attribute == 1)
{
char value[20];
int is_backspace = false;
int is_enter = false;
int IsDelete = false;
if (Event == VK_BACK)
{
is_backspace = true;
}
else if (Event == VK_RETURN)
{
is_enter = true;
}
else if (Event == VK_DELETE)
{
IsDelete = true;
}
else if ((Event >= 0x30 && Event <= 0x39) || (Event >= 0x60 && Event <= 0x69) || (Event >= 0x41 && Event <= 0x5A))
{
const int symbol = GetSymbolFromVK(Event);
if (symbol == 0)
{
return 1;
}
char buff[10];
sprintf(buff, "%c", symbol);
strcpy_s(value, buff);
}
else
{
return true;
}
if (is_backspace == true)
{
if (!strcmp(gInterface.Data[eChangePass_OLD].StatValue, ""))
{
return true;
}
gInterface.Data[eChangePass_OLD].StatValue[strlen(gInterface.Data[eChangePass_OLD].StatValue) - 1] = '\0';
gInterface.Data[eChangePass_OLD_HIDE].StatValue[strlen(gInterface.Data[eChangePass_OLD_HIDE].StatValue) - 1] = '\0';
}
else if (IsDelete == true)
{
strcpy_s(gInterface.Data[eChangePass_OLD].StatValue, "");
strcpy_s(gInterface.Data[eChangePass_OLD_HIDE].StatValue, "");
}
else
{
if (strlen(gInterface.Data[eChangePass_OLD].StatValue) < 10)
{
if (!strcmp(gInterface.Data[eChangePass_OLD].StatValue, ""))
{
strcpy_s(gInterface.Data[eChangePass_OLD].StatValue, value);
strcpy_s(gInterface.Data[eChangePass_OLD_HIDE].StatValue, "*");
}
else
{
strcat_s(gInterface.Data[eChangePass_OLD].StatValue, value);
strcat_s(gInterface.Data[eChangePass_OLD_HIDE].StatValue, "*");
}
}
}
}
else if (gInterface.Data[eChangePass_Main].OnShow && gInterface.Data[eChangePass_NEW].Attribute == 1)
{
char value[20];
int is_backspace = false;
int is_enter = false;
int IsDelete = false;
if (Event == VK_BACK)
{
is_backspace = true;
}
else if (Event == VK_RETURN)
{
is_enter = true;
}
else if (Event == VK_DELETE)
{
IsDelete = true;
}
else if ((Event >= 0x30 && Event <= 0x39) || (Event >= 0x60 && Event <= 0x69) || (Event >= 0x41 && Event <= 0x5A))
{
const int symbol = GetSymbolFromVK(Event);
if (symbol == 0)
{
return 1;
}
char buff[10];
sprintf(buff, "%c", symbol);
strcpy_s(value, buff);
}
else
{
return true;
}
if (is_backspace == true)
{
if (!strcmp(gInterface.Data[eChangePass_NEW].StatValue, ""))
{
return true;
}
gInterface.Data[eChangePass_NEW].StatValue[strlen(gInterface.Data[eChangePass_NEW].StatValue) - 1] = '\0';
gInterface.Data[eChangePass_NEW_HIDE].StatValue[strlen(gInterface.Data[eChangePass_NEW_HIDE].StatValue) - 1] = '\0';
}
//else if (is_enter == true)
//{
// //gPartySearch.SendPartyRequest(gPartySearch.currentIndex, gInterface.Data[OBJECT_PARTYPASSWORD_TEXTBOX].StatValue);
// //gPartySearch.party_search_password_switch_state();
// return 1;
//}
else if (IsDelete == true)
{
strcpy_s(gInterface.Data[eChangePass_NEW].StatValue, "");
strcpy_s(gInterface.Data[eChangePass_NEW_HIDE].StatValue, "");
}
else
{
if (strlen(gInterface.Data[eChangePass_NEW].StatValue) < 10)
{
if (!strcmp(gInterface.Data[eChangePass_NEW].StatValue, ""))
{
strcpy_s(gInterface.Data[eChangePass_NEW].StatValue, value);
strcpy_s(gInterface.Data[eChangePass_NEW_HIDE].StatValue, "*");
}
else
{
strcat_s(gInterface.Data[eChangePass_NEW].StatValue, value);
strcat_s(gInterface.Data[eChangePass_NEW_HIDE].StatValue, "*");
}
}
}
}
return false;
}
void QUAN_LY_TK::DRAW_WINDOW_CHANGEPASS()
{
if (gInterface.CheckWindow(CashShop)
|| gInterface.CheckWindow(SkillTree)
|| gInterface.CheckWindow(FullMap)
|| gInterface.CheckWindow(MoveList)
|| (gInterface.CheckWindow(Inventory)
&& gInterface.CheckWindow(ExpandInventory)
&& gInterface.CheckWindow(Store))
|| (gInterface.CheckWindow(Inventory)
&& gInterface.CheckWindow(Warehouse)
&& gInterface.CheckWindow(ExpandWarehouse)))
{
return;
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
if (!gInterface.Data[eChangePass_Main].OnShow)
{
return;
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
int JCResto = pWinWidth / pWinHeightReal / 2 - 320;
float MainW = 200;
float MainH = 170;
float CP_StartX = (MAX_WIN_WIDTH / 2) - (MainW / 2) + JCResto;
float MainCenter = StartX + (MainWidth / 2);
float ButtonX = MainCenter - (29.0 / 2);
float CuaSoW = 200.0;
float CuaSoH = 170.0;
//int JCResto = pWinWidth / pWinHeightReal / 2 - 320;
float StartX = (MAX_WIN_WIDTH / 2) - (CuaSoW / 2) + JCResto;
float StartY = 50.0;
float MainWidth_ = 380.0; // Mantiene la imagen al 40 % a la derecha
float MainHeight_ = 515.0; // Muevo la imagen un 30 % hacia abajo
float StartX_ = this->ultimoX + (MainWidth_ - 8.5) - (MainWidth_ * 0.53); // Mueve la imagen un 20% a la izquierda
float StartY_ = this->ultimoY + (MainHeight_ * 0.0); // Muevo la imagen un 30% hacia abajo
float curX = pCursorX >= MAX_WIN_WIDTH ? 0 : pCursorX;
float curY = pCursorY >= MAX_WIN_HEIGHT ? 0 : pCursorY;
RenderBitmap(78109, StartX_, StartY_ + 10, MainWidth_, MainHeight_, 0.0, 0.0, 1.0, 1.0, 1, 1, 0.0); // Fondo Dakosmu MENU
//gCentral.gDrawWindowCustom(StartX, StartY, CuaSoW, CuaSoH, eChangePass_Main, "Thay Đổi Mật Khẩu Tài Khoản");
//-----------------------------------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------------------------------
pSetCursorFocus = true;
//-----------------------------------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------------------------------
//gCItemSetOption.ItemTooltipS15(CP_StartX, gInterface.Data[eChangePass_Main].Y + 50, MainW, MainH, 0.0, 0);
float CP_StartY = gInterface.Data[eChangePass_Main].Y + 50;
//-----------------------------------------------------------------------------------------------------------------------------------------------------
gInterface.DrawGUI(eChangePass_BTCLOSE, CP_StartX + MainW - 34, gInterface.Data[eChangePass_Main].Y + 50);
if (gInterface.IsWorkZone(eChangePass_BTCLOSE))
{
DWORD Color = eGray150;
gInterface.DrawColoredGUI(eChangePass_BTCLOSE, gInterface.Data[eChangePass_BTCLOSE].X, gInterface.Data[eChangePass_BTCLOSE].Y, Color);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
gInterface.DrawFormat(eWhite, CP_StartX, gInterface.Data[eChangePass_Main].Y + 70, MainW, 3, "Cambie la contraseña de la cuenta");
if (gInterface.Data[eChangePass_Main].FirstLoad == true)
{
if (strlen(gInterface.Data[eChangePass_OLD].StatValue) == 0)
sprintf(gInterface.Data[eChangePass_OLD].StatValue, ""); //NONE
if (strlen(gInterface.Data[eChangePass_NEW].StatValue) == 0)
sprintf(gInterface.Data[eChangePass_NEW].StatValue, ""); //NONE
}
//=== Pass Cu
gInterface.DrawGUI(eChangePass_OLD, CP_StartX + (MainW / 2) - (gInterface.Data[eChangePass_OLD].Width / 2), CP_StartY + 50);
if (gInterface.Data[eChangePass_OLD].Attribute == 1)
{
gInterface.DrawColoredGUI(eChangePass_OLD, CP_StartX + (MainW / 2) - (gInterface.Data[eChangePass_OLD].Width / 2), CP_StartY + 50, eGray190);
}
gInterface.DrawText(eWhite, CP_StartX + (MainW / 2) - (gInterface.Data[eChangePass_OLD].Width / 2) + 10, CP_StartY + 55, 170, 1, "Contraseña anterior)");
gInterface.DrawText(eWhite, (CP_StartX + (MainW / 2) - (gInterface.Data[eChangePass_NEW].Width / 2)) + 60, CP_StartY + 55, 100, 3, gInterface.Data[eChangePass_OLD_HIDE].StatValue);
//=== Pass Moi
gInterface.DrawGUI(eChangePass_NEW, CP_StartX + (MainW / 2) - (gInterface.Data[eChangePass_NEW].Width / 2), CP_StartY + 80);
if (gInterface.Data[eChangePass_NEW].Attribute == 1)
{
gInterface.DrawColoredGUI(eChangePass_NEW, CP_StartX + (MainW / 2) - (gInterface.Data[eChangePass_NEW].Width / 2), CP_StartY + 80, eGray190);
}
gInterface.DrawText(eWhite, CP_StartX + (MainW / 2) - (gInterface.Data[eChangePass_NEW].Width / 2) + 10, CP_StartY + 85, 170, 1, "Una nueva contraseña)");
gInterface.DrawText(eWhite, (CP_StartX + (MainW / 2) - (gInterface.Data[eChangePass_NEW].Width / 2)) + 60, CP_StartY + 85, 100, 3, gInterface.Data[eChangePass_NEW_HIDE].StatValue);
gInterface.DrawButton(eChangePass_BTOK, CP_StartX + (MainW / 2) - (gInterface.Data[eChangePass_BTOK].Width / 2), CP_StartY + MainH - (50), 0, 0);
if (gInterface.IsWorkZone(eChangePass_BTOK))
{
int ScaleY = 30;
// ----
if (gInterface.Data[eChangePass_BTOK].OnClick)
{
ScaleY = 60;
}
// ----
gInterface.DrawButton(eChangePass_BTOK, CP_StartX + (MainW / 2) - (gInterface.Data[eChangePass_BTOK].Width / 2), CP_StartY + MainH - (50), 0, ScaleY);
}
//==============
if (gInterface.Data[eChangePass_Main].FirstLoad == true)
{
gInterface.Data[eChangePass_Main].FirstLoad = false;
}
}
#endif
QuanLyTaiKhoan.h
#pragma once
#if(QuanLy_TaiKhoan)
#include "Import.h"
#include "Interface.h"
#include "Protocol.h"
//-----------------------------------------------------------------------------------------------------------------------------------------------------
class QUAN_LY_TK
{
public:
//-----------------------------------------------------------------------------------------------------------------------------------------------------
QUAN_LY_TK();
void DRAW_QUAN_LY();
//-----------------------------------------------------------------------------------------------------------------------------------------------------
float MainWidth;
float MainHeight;
float StartY;
float StartX;
DWORD ClickTick;
float ultimoX;
float ultimoY;
//-----------------------------------------------------------------------------------------------------------------------------------------------------
void BinObeject();
void LoadImages();
//========== CHange Pass
void DRAW_WINDOW_CHANGEPASS();
void OPEN_WINDOW_CHANGEPASS() { gInterface.Data[eChangePass_Main].OnShow ^= true; gInterface.Data[eChangePass_Main].FirstLoad = true; *(BYTE*)0xE8C5AC ^= 1; };
bool EVENT_CLICK_CHANGEPASS(DWORD Event);
bool CHANGEPASS_TEXTBOX(DWORD Event);
//-----------------------------------------------------------------------------------------------------------------------------------------------------
}; extern QUAN_LY_TK G_QUAN_LY_TK;
//===================================================================================================================================================================
#endif
You may also like
Archivos
Calendar
| L | M | X | J | V | S | D |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||







Deja un comentario