From fc1ca42ed5a1b2d83a1dc8f94709a057b8e28e9d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Mar 2018 06:07:15 +0300 Subject: Add support for change pin code by server request. --- src/net/eathena/charserverhandler.cpp | 10 ++++++++++ src/net/eathena/charserverhandler.h | 4 ++++ src/net/eathena/charserverrecv.cpp | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/net/eathena') diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 71bf6aeee..630dca675 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -214,6 +214,16 @@ void CharServerHandler::sendCheckPincode(const BeingId accountId, outMsg.writeString(pin, 4, "encrypted pin"); } +void CharServerHandler::changePincode(const BeingId accountId, + const std::string &oldPin, + const std::string &newPin) const +{ + createOutPacket(CMSG_CHAR_PIN_CHANGE); + outMsg.writeBeingId(accountId, "account id"); + outMsg.writeString(oldPin, 4, "old encrypted pin"); + outMsg.writeString(newPin, 4, "new encrypted pin"); +} + void CharServerHandler::renameCharacter(const BeingId id, const std::string &newName) const { diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h index f41b14a79..a712c5a56 100644 --- a/src/net/eathena/charserverhandler.h +++ b/src/net/eathena/charserverhandler.h @@ -68,6 +68,10 @@ class CharServerHandler final : public Ea::CharServerHandler void sendCheckPincode(const BeingId accountId, const std::string &pin) const override final; + void changePincode(const BeingId accountId, + const std::string &oldPin, + const std::string &newPin) const override final; + /** * Sets the character create dialog. The handler will clean up this * dialog when a new character is successfully created, and will unlock diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp index 6d5fd63ca..ece603ac2 100644 --- a/src/net/eathena/charserverrecv.cpp +++ b/src/net/eathena/charserverrecv.cpp @@ -370,7 +370,7 @@ void CharServerRecv::processPincodeStatus(Net::MessageIn &msg) case 8: // pincode was incorrect case 5: // client show error? pincodeManager.wrongPin(); - break; + return; case 6: // Unable to use your KSSN number break; case 7: // char select window shows a button @@ -379,6 +379,8 @@ void CharServerRecv::processPincodeStatus(Net::MessageIn &msg) UNIMPLEMENTEDPACKET; break; } + if (client) + client->updatePinState(); } void CharServerRecv::processCharCreate(Net::MessageIn &msg) -- cgit v1.2.3-60-g2f50