Skip to content

Commit

Permalink
Merge pull request #784 from ryanbennitt/feature/remember-password-op…
Browse files Browse the repository at this point in the history
…tion

Feature/remember password option
  • Loading branch information
AntlerForce authored Oct 29, 2024
2 parents f9d228a + 484c434 commit d46d19d
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
8 changes: 7 additions & 1 deletion LuaMenu/widgets/chobby/components/configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function Configuration:init()
self.suggestedNameFromSteam = false
self.password = false
self.autoLogin = true
self.rememberPassword = true
self.uploadLogPrompt = 'Prompt'
self.firstLoginEver = true
self.canAuthenticateWithSteam = false
Expand Down Expand Up @@ -635,6 +636,10 @@ function Configuration:SetConfigData(data)
end

function Configuration:GetConfigData()
local rememberedPassword = false
if self.rememberPassword then
rememberedPassword = self.password
end
return {
tempChangedShowSkill = self.tempChangedShowSkill, -- should be removed at 1.1.2024
autoLaunchAsSpectator = self.autoLaunchAsSpectator,
Expand All @@ -643,7 +648,8 @@ function Configuration:GetConfigData()
userName = self.userName,
suggestedNameFromSteam = self.suggestedNameFromSteam,
uiScalesForScreenSizes = self.uiScalesForScreenSizes,
password = self.password,
rememberPassword = self.rememberPassword,
password = rememberedPassword,
autoLogin = self.autoLogin,
uploadLogPrompt = self.uploadLogPrompt,
firstLoginEver = self.firstLoginEver,
Expand Down
32 changes: 32 additions & 0 deletions LuaMenu/widgets/chobby/components/login_window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,38 @@ function LoginWindow:init(failFunction, cancelText, windowClassname, params)
}
registerChildren[#registerChildren + 1] = self.cbAutoLoginRegister

self.cbRememberPassword = Checkbox:New {
x = 15,
width = 215,
y = self.windowHeight - 215,
height = 35,
boxalign = "right",
boxsize = 15,
caption = i18n("rememberPassword"),
checked = Configuration.rememberPassword,
objectOverrideFont = WG.Chobby.Configuration:GetFont(2),
OnClick = {function (obj)
Configuration:SetConfigValue("rememberPassword", obj.checked)
end},
}
loginChildren[#loginChildren+1] = self.cbRememberPassword

self.cbRememberPasswordRegister = Checkbox:New {
x = 15,
width = 215,
y = self.windowHeight - 215,
height = 35,
boxalign = "right",
boxsize = 15,
caption = i18n("rememberPassword"),
checked = Configuration.rememberPassword,
objectOverrideFont = WG.Chobby.Configuration:GetFont(2),
OnClick = {function (obj)
Configuration:SetConfigValue("rememberPassword", obj.checked)
end},
}
registerChildren[#registerChildren + 1] = self.cbRememberPasswordRegister

self.txtError = TextBox:New {
x = 15,
right = 15,
Expand Down
2 changes: 2 additions & 0 deletions LuaMenu/widgets/chobby/i18n/chililobby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ return {
alt_acknowledgement = 'By pressing Register, you acknowledge the\nrules concerning alt accounts.',
register_steam_long = "Enter a username for multiplayer",
autoLogin = "Login automatically",
rememberPassword = "Remember password",
authenticateSteam = "Authenticate with Steam",
play_offline = "Play offline",
keys = "Keys",
Expand Down Expand Up @@ -367,6 +368,7 @@ return {
register_long = "Account erstellen",
register_steam_long = "Benutzername für den Mehrspieler-Modus wählen",
autoLogin = "Automatisch einloggen",
rememberPassword = "Passwort merken",
authenticateSteam = "Mit Steam authentifizieren",
play_offline = "Offline spielen",
-- gui_battle_status_panel
Expand Down
22 changes: 22 additions & 0 deletions LuaMenu/widgets/gui_settings_window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,25 @@ local function GetLobbyTabControls()
children[#children + 1] = autoLogin
offset = offset + ITEM_OFFSET

local rememberPassword = Checkbox:New {
x = 20,
width = CHECK_WIDTH,
y = offset,
height = 30,
boxalign = "right",
boxsize = 20,
caption = i18n("rememberPassword"),
checked = Configuration.rememberPassword or false,
objectOverrideFont = WG.Chobby.Configuration:GetFont(2),
OnChange = {function (obj, newState)
freezeSettings = true
Configuration:SetConfigValue("rememberPassword", newState)
freezeSettings = false
end},
}
children[#children + 1] = rememberPassword
offset = offset + ITEM_OFFSET

local cbQueueExitConfirmPromptDoNotAskAgain
cbQueueExitConfirmPromptDoNotAskAgain, offset = AddCheckboxSetting(offset, i18n("queueExitConfirmPromptDoNotAskAgain"), "queueExitConfirmPromptDoNotAskAgain", true, nil , i18n("queueExitConfirmPromptDoNotAskAgain_tooltip"))
children[#children + 1] = cbQueueExitConfirmPromptDoNotAskAgain
Expand Down Expand Up @@ -1193,6 +1212,9 @@ local function GetLobbyTabControls()
if key == "autoLogin" then
autoLogin:SetToggle(value)
end
if key == "rememberPassword" then
rememberPassword:SetToggle(value)
end
if key == "randomSkirmishSetup" then
if value == true then
Spring.SetConfigInt("randomSkirmishSetup", 1)
Expand Down

0 comments on commit d46d19d

Please sign in to comment.