summaryrefslogtreecommitdiff
path: root/src/net/accountserver/accountserver.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2008-04-21 16:18:03 +0000
committerYohann Ferreira <bertram@cegetel.net>2008-04-21 16:18:03 +0000
commitac1a456a90d06ba7765716643257ec33cc513f76 (patch)
tree5cc5a9ce24942bcac3d2fa4b45d8d92375313cc1 /src/net/accountserver/accountserver.cpp
parent24681ad4312d804aa06c8ace7d1a9f2f9605a4eb (diff)
downloadmana-client-ac1a456a90d06ba7765716643257ec33cc513f76.tar.gz
mana-client-ac1a456a90d06ba7765716643257ec33cc513f76.tar.bz2
mana-client-ac1a456a90d06ba7765716643257ec33cc513f76.tar.xz
mana-client-ac1a456a90d06ba7765716643257ec33cc513f76.zip
Added password encryption client-side using SHA256.
Diffstat (limited to 'src/net/accountserver/accountserver.cpp')
-rw-r--r--src/net/accountserver/accountserver.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/net/accountserver/accountserver.cpp b/src/net/accountserver/accountserver.cpp
index 651758a6..a641ab47 100644
--- a/src/net/accountserver/accountserver.cpp
+++ b/src/net/accountserver/accountserver.cpp
@@ -23,6 +23,9 @@
#include "accountserver.h"
+#include <string>
+#include "../../utils/encryption.h"
+
#include "internal.h"
#include "../connection.h"
@@ -38,7 +41,9 @@ void Net::AccountServer::login(Net::Connection *connection, int version,
msg.writeInt32(version);
msg.writeString(username);
- msg.writeString(password);
+ // The password is hashed
+ msg.writeString(Encryption::GetSHA2Hash(
+ std::string (username + password)));
Net::AccountServer::connection->send(msg);
}
@@ -53,6 +58,9 @@ void Net::AccountServer::registerAccount(Net::Connection *connection,
msg.writeInt32(version); // client version
msg.writeString(username);
+ // When registering, the password and email hash is assumed by server.
+ // Hence, data can be validated safely server-side.
+ // This is the only time we send a clear password.
msg.writeString(password);
msg.writeString(email);