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)
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
|
||||
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"))
|
||||
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"
|
||||
o.datatype = "minlength(1)"
|
||||
function o:write(data)
|
||||
|
@ -1,10 +1,10 @@
|
||||
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 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
|
||||
end
|
||||
|
||||
|
@ -13,7 +13,7 @@ You may obtain a copy of the License at
|
||||
local nixio = require "nixio"
|
||||
local fs = require "nixio.fs"
|
||||
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 s = f_keys:section(Section)
|
||||
@ -31,13 +31,13 @@ function keys:write(value)
|
||||
end
|
||||
end
|
||||
|
||||
local config = (site.config_mode or {}).remote_login or {}
|
||||
if not config.show_password_form then
|
||||
local config = site.config_mode.remote_login
|
||||
if not config.show_password_form(false) then
|
||||
-- password login is disabled in site.conf
|
||||
return f_keys
|
||||
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 length_hint
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user