summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorjonkoorm <jonkoorm@users.noreply.gitlab.com>2021-10-24 15:54:49 -0500
committerjonkoorm <jonkoorm@users.noreply.gitlab.com>2021-10-24 16:07:26 -0500
commit4d3f49696ef96e78b8d1653c86b83b257f4dbec8 (patch)
tree81b0117d15984af28411f4dea3b4cfca72453984 /src/net
parentb47e02f1e70a1f303bee370110448d92bc0a3684 (diff)
downloadmanaverse-keep_password.tar.gz
manaverse-keep_password.tar.bz2
manaverse-keep_password.tar.xz
manaverse-keep_password.zip
Enable password remembering in user loginkeep_password
Password is recorded in the 'password' option in config.xml The 'remember_password' option is added to save the status
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/loginhandler.cpp19
-rw-r--r--src/net/logindata.h2
2 files changed, 11 insertions, 10 deletions
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 2fc177476..fbae0813f 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -153,21 +153,20 @@ void LoginHandler::loginOrRegister(LoginData *const data) const
const bool remember = data->remember;
if (remember)
- {
serverConfig.setValue("username", data->username);
-#ifdef SAVE_PASSWORD
- serverConfig.setValue("password", data->password);
-#endif
- }
else
- {
serverConfig.setValue("username", "");
-#ifdef SAVE_PASSWORD
- serverConfig.setValue("password", "");
-#endif
- }
+
serverConfig.setValue("remember", remember);
+ const bool remember_password = data->remember_password;
+ if (remember_password)
+ serverConfig.setValue("password", data->password);
+ else
+ serverConfig.setValue("password", "");
+
+ serverConfig.setValue("remember_password", remember_password);
+
// Clear the password, avoids auto login when returning to login
data->password.clear();
}
diff --git a/src/net/logindata.h b/src/net/logindata.h
index 68306dced..61a3d1c7a 100644
--- a/src/net/logindata.h
+++ b/src/net/logindata.h
@@ -48,6 +48,7 @@ class LoginData final
gender(Gender::UNSPECIFIED),
packetVersion(0),
remember(false),
+ remember_password(false),
registerLogin(false),
characterSlots(9)
{
@@ -71,6 +72,7 @@ class LoginData final
int packetVersion;
bool remember; // Whether to store the username.
+ bool remember_password; // Whether to store the password.
bool registerLogin; // Whether an account is being registered.
uint16_t characterSlots; // The number of character slots