summaryrefslogtreecommitdiff
path: root/src/net/ea/loginhandler.cpp
diff options
context:
space:
mode:
authorDennis Friis <peavey@inspircd.org>2009-05-25 05:23:40 +0200
committerDennis Friis <peavey@inspircd.org>2009-05-25 05:28:03 +0200
commitef006ed117bb602a928d33dc0fe90075efd7393f (patch)
treed82e8b7a1aedc7999c232d08bd12d0c50a343f9a /src/net/ea/loginhandler.cpp
parent050103b8d2e3eb23e7aea188a1a269feb7c181ab (diff)
downloadmana-ef006ed117bb602a928d33dc0fe90075efd7393f.tar.gz
mana-ef006ed117bb602a928d33dc0fe90075efd7393f.tar.bz2
mana-ef006ed117bb602a928d33dc0fe90075efd7393f.tar.xz
mana-ef006ed117bb602a928d33dc0fe90075efd7393f.zip
Add athena netcode for changing account password.
Diffstat (limited to 'src/net/ea/loginhandler.cpp')
-rw-r--r--src/net/ea/loginhandler.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 31d2c020..8f66343f 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -46,6 +46,7 @@ LoginHandler::LoginHandler()
SMSG_UPDATE_HOST,
SMSG_LOGIN_DATA,
SMSG_LOGIN_ERROR,
+ SMSG_CHAR_PASSWORD_RESPONSE,
0
};
handledMessages = _messages;
@@ -58,6 +59,37 @@ void LoginHandler::handleMessage(MessageIn &msg)
switch (msg.getId())
{
+ case SMSG_CHAR_PASSWORD_RESPONSE:
+ {
+ // 0: acc not found, 1: success, 2: password mismatch, 3: pass too short
+ int errMsg = msg.readInt8();
+ // Successful pass change
+ if (errMsg == 1)
+ {
+ state = STATE_CHANGEPASSWORD;
+ }
+ // pass change failed
+ else
+ {
+ switch (errMsg) {
+ case 0:
+ errorMessage = _("Account not connected. Please login first.");
+ break;
+ case 2:
+ errorMessage = _("Old password incorrect");
+ break;
+ case 3:
+ errorMessage = _("New password too short");
+ break;
+ default:
+ errorMessage = _("Unknown error");
+ break;
+ }
+ state = STATE_ACCOUNTCHANGE_ERROR;
+ }
+ }
+ break;
+
case SMSG_UPDATE_HOST:
int len;
@@ -157,7 +189,9 @@ void LoginHandler::changePassword(const std::string &username,
const std::string &oldPassword,
const std::string &newPassword)
{
- // TODO
+ MessageOut outMsg(CMSG_CHAR_PASSWORD_CHANGE);
+ outMsg.writeString(oldPassword, 24);
+ outMsg.writeString(newPassword, 24);
}
void LoginHandler::chooseServer(int server)