mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-30 19:22:14 +00:00
add option to remember passwords
This commit is contained in:
parent
604e96ba0a
commit
ea24973f0d
2 changed files with 15 additions and 3 deletions
|
@ -96,6 +96,11 @@ local function get_formspec(tabview, name, tabdata)
|
|||
tabdata.search_for = ""
|
||||
end
|
||||
|
||||
local password = ""
|
||||
if core.settings:get_bool("remember_password") then
|
||||
password = core.settings:get("password")
|
||||
end
|
||||
|
||||
local retval =
|
||||
-- Search
|
||||
"field[0.25,0.25;7,0.75;te_search;;" .. core.formspec_escape(tabdata.search_for) .. "]" ..
|
||||
|
@ -130,7 +135,7 @@ local function get_formspec(tabview, name, tabdata)
|
|||
"label[0.25,0;" .. fgettext("Name") .. "]" ..
|
||||
"label[2.875,0;" .. fgettext("Password") .. "]" ..
|
||||
"field[0.25,0.2;2.625,0.75;te_name;;" .. core.formspec_escape(core.settings:get("name")) .. "]" ..
|
||||
"pwdfield[2.875,0.2;2.625,0.75;te_pwd;;" .. core.formspec_escape(core.settings:get("password")) .. "]" ..
|
||||
"pwdfield[2.875,0.2;2.625,0.75;te_pwd;;" .. core.formspec_escape(password) .. "]" ..
|
||||
"container_end[]" ..
|
||||
|
||||
-- Connect
|
||||
|
@ -443,9 +448,13 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
core.settings:set("name", fields.te_name)
|
||||
end
|
||||
|
||||
if core.settings:get_bool("remember_password") then
|
||||
if fields.te_pwd then
|
||||
core.settings:set("password", fields.te_pwd)
|
||||
end
|
||||
else
|
||||
core.settings:set("password", "")
|
||||
end
|
||||
|
||||
if fields.servers then
|
||||
local event = core.explode_table_event(fields.servers)
|
||||
|
|
|
@ -871,6 +871,9 @@ tooltip_append_itemname (Append item name) bool false
|
|||
# Use a cloud animation for the main menu background.
|
||||
menu_clouds (Clouds in menu) bool true
|
||||
|
||||
# Remember last entered password in the 'Join Game' tab
|
||||
remember_password (Remember password) bool false
|
||||
|
||||
[**HUD]
|
||||
|
||||
# Modifies the size of the HUD elements.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue