Added a button for the unified inventory. Updated the password entry form interface.
This commit is contained in:
parent
c0866ad612
commit
d49f208669
31
init.lua
31
init.lua
@ -17,16 +17,18 @@ label[0.5,3.4;Сообщение]
|
|||||||
local function get_formspec_main(name)
|
local function get_formspec_main(name)
|
||||||
local formspec = {
|
local formspec = {
|
||||||
"size[8,5]",
|
"size[8,5]",
|
||||||
"label[0.2,0.4;".. S("Attention! The site is under development.") .."]",
|
--"label[0.2,0.4;".. S("Attention! The site is under development.") .."]",
|
||||||
"label[0.2,1;" .. S("Enter your password to log in to the site") .. "]",
|
"label[0.2,0.4;" .. S("Enter your password to log in to the site") .. "]",
|
||||||
|
--"<action name=apocalypse.texnoblog.uz url=https://apocalypse.texnoblog.uz>...</action>",
|
||||||
"field[0.5,2.2;5,0.8;pass;".. S("Password") ..";]",
|
"field[0.5,2.2;5,0.8;pass;".. S("Password") ..";]",
|
||||||
"button[4.3,3.4;3,0.8;save;".. S("Save") .."]",
|
"button[4.3,3.0;3,0.8;save;".. S("Save") .."]",
|
||||||
|
"button_url[0.2,4.5;4,0;url;"..S("Go to the authorization page")..";https://apocalypse.texnoblog.uz/authorization]",
|
||||||
}
|
}
|
||||||
if pass[name] == 'empty' then
|
if pass[name] == 'empty' then
|
||||||
table.insert(formspec, 'label[0.2,3.4;'.. S("The password field must not be empty.") ..']')
|
table.insert(formspec, 'label[0.2,3.0;'.. S("The password field must not be empty.") ..']')
|
||||||
end
|
end
|
||||||
if pass[name] == 'success' then
|
if pass[name] == 'success' then
|
||||||
table.insert(formspec, 'label[0.2,3.4;'.. S("Password saved") ..']')
|
table.insert(formspec, 'label[0.2,3.0;'.. S("Password saved") ..']')
|
||||||
end
|
end
|
||||||
|
|
||||||
return table.concat(formspec, "")
|
return table.concat(formspec, "")
|
||||||
@ -43,6 +45,11 @@ minetest.register_chatcommand("set_site_pass", {
|
|||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
||||||
|
if fields.set_site_pass_ui then
|
||||||
|
minetest.show_formspec(name, "site_connect:set_password", get_formspec_main(name))
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
if formname ~= "site_connect:set_password" then
|
if formname ~= "site_connect:set_password" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -62,4 +69,16 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
minetest.show_formspec(name, "site_connect:set_password", get_formspec_main(name))
|
minetest.show_formspec(name, "site_connect:set_password", get_formspec_main(name))
|
||||||
--minetest.chat_send_all(sha256(fields.pass))
|
--minetest.chat_send_all(sha256(fields.pass))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
if minetest.global_exists("unified_inventory") then
|
||||||
|
unified_inventory.register_button("set_site_pass_ui", {
|
||||||
|
type = "image",
|
||||||
|
image = "site_connect_password.png",
|
||||||
|
tooltip = S("Set a password for the site"),
|
||||||
|
hide_lite = true,
|
||||||
|
condition = function(player)
|
||||||
|
return minetest.check_player_privs(player:get_player_name(), {interact=true})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
@ -1,4 +1,5 @@
|
|||||||
# textdomain: site_connect
|
# textdomain: site_connect
|
||||||
|
|
||||||
Attention! The site is under development.=Внимание! Сайт в процессе разработки.
|
Attention! The site is under development.=Внимание! Сайт в процессе разработки.
|
||||||
Enter your password to log in to the site=Введите пароль для авторизации на сайте
|
Enter your password to log in to the site=Введите пароль для авторизации на сайте
|
||||||
Password=Пароль
|
Password=Пароль
|
||||||
@ -6,3 +7,5 @@ Save=Сохранить
|
|||||||
The password field must not be empty.=Поле пароля не должно быть пустым
|
The password field must not be empty.=Поле пароля не должно быть пустым
|
||||||
Password saved=Пароль сохранен
|
Password saved=Пароль сохранен
|
||||||
Setting up an authorization password for the site=Установка авторизационного пароля на сайт
|
Setting up an authorization password for the site=Установка авторизационного пароля на сайт
|
||||||
|
Set a password for the site=Установить пароль для сайта
|
||||||
|
Go to the authorization page=Перейти на страницу авторизации
|
1
mod.conf
1
mod.conf
@ -3,3 +3,4 @@ description = Allows you to interact with the site via sql
|
|||||||
min_minetest_version = 5.7
|
min_minetest_version = 5.7
|
||||||
title = Site Connect
|
title = Site Connect
|
||||||
author = VinAdmin
|
author = VinAdmin
|
||||||
|
optional_depends = unified_inventory
|
||||||
|
BIN
textures/site_connect_password.png
Normal file
BIN
textures/site_connect_password.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 997 B |
Loading…
Reference in New Issue
Block a user