summaryrefslogtreecommitdiff
path: root/src/net/ea/loginhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-06 00:39:58 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-06 23:06:15 +0300
commit6b291b6515825f4ce0e09df5dec7ea1b619b63a7 (patch)
treef26a35a21cde34f45538a191b2196bf7c81d2693 /src/net/ea/loginhandler.cpp
parent833e498f54c1d33be94c09214315b368cccaec06 (diff)
downloadmanaverse-6b291b6515825f4ce0e09df5dec7ea1b619b63a7.tar.gz
manaverse-6b291b6515825f4ce0e09df5dec7ea1b619b63a7.tar.bz2
manaverse-6b291b6515825f4ce0e09df5dec7ea1b619b63a7.tar.xz
manaverse-6b291b6515825f4ce0e09df5dec7ea1b619b63a7.zip
improve a bit different code.
Diffstat (limited to 'src/net/ea/loginhandler.cpp')
-rw-r--r--src/net/ea/loginhandler.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 44d834b94..df1516b8b 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -291,6 +291,30 @@ void LoginHandler::processLoginError(Net::MessageIn &msg) const
client->setState(STATE_ERROR);
}
+void LoginHandler::loginOrRegister(LoginData *const data)
+{
+ if (!data)
+ return;
+
+ logger->log("Username is %s", data->username.c_str());
+
+ // Send login infos
+ if (data->registerLogin)
+ registerAccount(data);
+ else
+ loginAccount(data);
+
+ // Clear the password, avoids auto login when returning to login
+ data->password.clear();
+
+ const bool remember = data->remember;
+ if (remember)
+ serverConfig.setValue("username", data->username);
+ else
+ serverConfig.setValue("username", "");
+ serverConfig.setValue("remember", remember);
+}
+
void LoginHandler::logout() const
{
}