gluon-config-mode-*, gluon-web-admin: use new gluon.site library to avoid 'or {}' syntax
This commit is contained in:
parent
eef3bba123
commit
951f62ac85
@ -1,5 +1,5 @@
|
|||||||
return function(form, uci)
|
return function(form, uci)
|
||||||
local site = require 'gluon.site_config'
|
local site = require 'gluon.site'
|
||||||
|
|
||||||
local owner = uci:get_first("gluon-node-info", "owner")
|
local owner = uci:get_first("gluon-node-info", "owner")
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ return function(form, uci)
|
|||||||
|
|
||||||
local o = s:option(Value, "contact", translate("Contact info"), translate("e.g. E-mail or phone number"))
|
local o = s:option(Value, "contact", translate("Contact info"), translate("e.g. E-mail or phone number"))
|
||||||
o.default = uci:get("gluon-node-info", owner, "contact")
|
o.default = uci:get("gluon-node-info", owner, "contact")
|
||||||
o.optional = not ((site.config_mode or {}).owner or {}).obligatory
|
o.optional = not site.config_mode.owner.obligatory(false)
|
||||||
-- without a minimal length, an empty string will be accepted even with "optional = false"
|
-- without a minimal length, an empty string will be accepted even with "optional = false"
|
||||||
o.datatype = "minlength(1)"
|
o.datatype = "minlength(1)"
|
||||||
function o:write(data)
|
function o:write(data)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
return function(form, uci)
|
return function(form, uci)
|
||||||
local site = require 'gluon.site_config'
|
local site = require 'gluon.site'
|
||||||
|
|
||||||
local location = uci:get_first("gluon-node-info", "location")
|
local location = uci:get_first("gluon-node-info", "location")
|
||||||
|
|
||||||
local function show_altitude()
|
local function show_altitude()
|
||||||
if ((site.config_mode or {}).geo_location or {}).show_altitude ~= false then
|
if site.config_mode.geo_location.show_altitude(true) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ You may obtain a copy of the License at
|
|||||||
local nixio = require "nixio"
|
local nixio = require "nixio"
|
||||||
local fs = require "nixio.fs"
|
local fs = require "nixio.fs"
|
||||||
local util = require "gluon.util"
|
local util = require "gluon.util"
|
||||||
local site = require 'gluon.site_config'
|
local site = require "gluon.site"
|
||||||
|
|
||||||
local f_keys = Form(translate("SSH keys"), translate("You can provide your SSH keys here (one per line):"), 'keys')
|
local f_keys = Form(translate("SSH keys"), translate("You can provide your SSH keys here (one per line):"), 'keys')
|
||||||
local s = f_keys:section(Section)
|
local s = f_keys:section(Section)
|
||||||
@ -31,13 +31,13 @@ function keys:write(value)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local config = (site.config_mode or {}).remote_login or {}
|
local config = site.config_mode.remote_login
|
||||||
if not config.show_password_form then
|
if not config.show_password_form(false) then
|
||||||
-- password login is disabled in site.conf
|
-- password login is disabled in site.conf
|
||||||
return f_keys
|
return f_keys
|
||||||
end
|
end
|
||||||
|
|
||||||
local min_password_length = config.min_password_length or 12
|
local min_password_length = config.min_password_length(12)
|
||||||
local mintype = 'minlength(' .. min_password_length .. ')'
|
local mintype = 'minlength(' .. min_password_length .. ')'
|
||||||
local length_hint
|
local length_hint
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user