Skip to content
Snippets Groups Projects
Unverified Commit 951f62ac authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-config-mode-*, gluon-web-admin: use new gluon.site library to avoid 'or {}' syntax

parent eef3bba1
No related branches found
No related tags found
No related merge requests found
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)
......
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment