Index: ps/trunk/binaries/data/config/default.cfg =================================================================== --- ps/trunk/binaries/data/config/default.cfg +++ ps/trunk/binaries/data/config/default.cfg @@ -405,6 +405,7 @@ server = "lobby.wildfiregames.com" ; Address of lobby server xpartamupp = "wfgbot23" ; Name of the server-side xmpp client that manage games buddies = "," ; Comma separated list of playernames that the current user has marked as buddies +rememberpassword = true ; Whether to store the encrypted password in the user config [lobby.columns] gamerating = false ; Show the average rating of the participating players in a column of the gamelist Index: ps/trunk/binaries/data/mods/public/gui/prelobby/prelobby.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/prelobby/prelobby.js +++ ps/trunk/binaries/data/mods/public/gui/prelobby/prelobby.js @@ -7,6 +7,8 @@ function init() { + Engine.GetGUIObjectByName("rememberPassword").checked = + Engine.ConfigDB_GetValue("user", "lobby.rememberpassword") == "true"; g_EncryptedPassword = Engine.ConfigDB_GetValue("user", "lobby.password"); if (Engine.ConfigDB_GetValue("user", "lobby.login") && g_EncryptedPassword) switchPage("connect"); @@ -196,7 +198,14 @@ // We only store the encrypted password, so make sure to re-encrypt it if changed before saving. if (password != g_EncryptedPassword.substring(0, 10)) g_EncryptedPassword = Engine.EncryptPassword(password, username); - saveSettingAndWriteToUserConfig("lobby.password", g_EncryptedPassword); + Engine.ConfigDB_CreateValue("user", "lobby.password", g_EncryptedPassword); + if (Engine.ConfigDB_GetValue("user", "lobby.rememberpassword") == "true") + Engine.ConfigDB_WriteValueToFile("user", "lobby.password", g_EncryptedPassword, "config/user.cfg"); + else + { + Engine.ConfigDB_RemoveValue("user", "lobby.password"); + Engine.ConfigDB_WriteFile("user", "config/user.cfg"); + } break; } } @@ -277,3 +286,22 @@ else Engine.PopGuiPage(); } + +function toggleRememberPassword() +{ + let checkbox = Engine.GetGUIObjectByName("rememberPassword"); + let enabled = Engine.ConfigDB_GetValue("user", "lobby.rememberpassword") == "true"; + if (!checkbox.checked && enabled && Engine.ConfigDB_GetValue("user", "lobby.password")) + { + messageBox( + 360, 160, + translate("Are you sure you want to delete the password after connecting?"), + translate("Confirmation"), + [translate("No"), translate("Yes")], + [function() { checkbox.checked = true; }, + function() { saveSettingAndWriteToUserConfig("lobby.rememberpassword", String(!enabled)); }] + ); + } + else + saveSettingAndWriteToUserConfig("lobby.rememberpassword", String(!enabled)); +} Index: ps/trunk/binaries/data/mods/public/gui/prelobby/prelobby.xml =================================================================== --- ps/trunk/binaries/data/mods/public/gui/prelobby/prelobby.xml +++ ps/trunk/binaries/data/mods/public/gui/prelobby/prelobby.xml @@ -59,6 +59,14 @@ lobbyStartConnect(); + + + toggleRememberPassword(); + + + + Remember Password +