mirror of
https://git.phreedom.club/localhost_frssoft/fediauth.git
synced 2024-11-25 17:31:29 +00:00
image/issuer customization
This commit is contained in:
parent
0b6fc9269f
commit
d140a845f1
18
onboard.lua
18
onboard.lua
|
@ -16,13 +16,19 @@ minetest.register_chatcommand("otp_enable", {
|
||||||
description = "Enable the otp verification",
|
description = "Enable the otp verification",
|
||||||
func = function(name)
|
func = function(name)
|
||||||
-- issuer name
|
-- issuer name
|
||||||
local issuer = "Minetest"
|
local issuer = minetest.settings:get("otp.issuer") or "Minetest"
|
||||||
if minetest.settings:get("server_name") ~= "" then
|
local server_name = minetest.settings:get("server_name")
|
||||||
issuer = minetest.settings:get("server_name")
|
local server_address = minetest.settings:get("server_address")
|
||||||
elseif minetest.settings:get("server_address") ~= "" then
|
if server_name and server_name ~= "" then
|
||||||
issuer = minetest.settings:get("server_address")
|
issuer = server_name
|
||||||
|
elseif server_address and server_address ~= "" then
|
||||||
|
issuer = server_address
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- authenticator image
|
||||||
|
local image = minetest.settings:get("otp.authenticator_image") or
|
||||||
|
"https://raw.githubusercontent.com/minetest/minetest/master/misc/minetest-xorg-icon-128.png"
|
||||||
|
|
||||||
local secret_b32 = otp.get_player_secret_b32(name)
|
local secret_b32 = otp.get_player_secret_b32(name)
|
||||||
|
|
||||||
-- url for the qr code
|
-- url for the qr code
|
||||||
|
@ -31,7 +37,7 @@ minetest.register_chatcommand("otp_enable", {
|
||||||
"&issuer=" .. issuer ..
|
"&issuer=" .. issuer ..
|
||||||
"&period=30" ..
|
"&period=30" ..
|
||||||
"&secret=" .. secret_b32 ..
|
"&secret=" .. secret_b32 ..
|
||||||
"&image=https://raw.githubusercontent.com/minetest/minetest/master/misc/minetest-xorg-icon-128.png"
|
"&image=" .. image
|
||||||
|
|
||||||
local ok, code = otp.qrcode(url)
|
local ok, code = otp.qrcode(url)
|
||||||
if not ok then
|
if not ok then
|
||||||
|
|
|
@ -37,6 +37,11 @@ minetest.register_privilege("my_super_important_priv", {
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Settings
|
||||||
|
|
||||||
|
* `otp.authenticator_image` The image to use in the QR code for the otp app (defaults to "https://raw.githubusercontent.com/minetest/minetest/master/misc/minetest-xorg-icon-128.png")
|
||||||
|
* `otp.issuer` The issuer name, defaults to server name, address or just "Minetest"
|
||||||
|
|
||||||
# Links / References
|
# Links / References
|
||||||
|
|
||||||
* https://en.wikipedia.org/wiki/Time-based_one-time_password
|
* https://en.wikipedia.org/wiki/Time-based_one-time_password
|
||||||
|
|
Loading…
Reference in a new issue