Validate some fields and set some fields widths

This commit is contained in:
emanuele-f 2016-12-31 16:47:59 +01:00 committed by Simone Mainardi
parent 3e46607fc6
commit 75b5fd068e
3 changed files with 65 additions and 14 deletions

View file

@ -39,6 +39,7 @@ alerts_active = ""
users_active = ""
ifaces_active = ""
logging_active = ""
local PREFS_INPUT_WIDTH_MEDIUM = "19em"
if (subpage_active == nil or subpage_active == "") then
subpage_active = "users"
@ -366,7 +367,7 @@ function printUsers()
,
"ntopng.prefs.",
"google_apis_browser_key",
"", false)
"", false, nil, nil, nil, {style={width="24em;"}, attributes={pattern="[a-zA-Z0-9]{39}"} --[[ Google API keys consist of 39 alphanumeric characters ]] })
if ntop.isPro() then
print('<tr><th colspan=2 class="info">Authentication</th></tr>')
@ -400,7 +401,7 @@ function printUsers()
"Choose your account type",
labels_account, values_account, "posix", "primary", "multiple_ldap_account_type", "ntopng.prefs.ldap.account_type", nil, nil, nil, nil, showElements)
prefsInputFieldPrefs("LDAP Server Address", "IP address and port of LDAP server (e.g. ldaps://localhost:636). Default: \"ldap://localhost:389\".", "ntopng.prefs.ldap", "server", "ldap://localhost:389", nil, showElements, true, true)
prefsInputFieldPrefs("LDAP Server Address", "IP address and port of LDAP server (e.g. ldaps://localhost:636). Default: \"ldap://localhost:389\".", "ntopng.prefs.ldap", "server", "ldap://localhost:389", nil, showElements, true, true, {attributes={pattern="ldap(s)?://[0-9.\\-A-Za-z]+(:[0-9]+)?", required="required"}, style={width=PREFS_INPUT_WIDTH_MEDIUM}})
local elementToSwitchBind = {"bind_dn","bind_pwd"}
toggleTableButtonPrefs("LDAP Anonymous Binding","Enable anonymous binding.","On", "1", "success", "Off", "0", "danger", "toggle_ldap_anonymous_bind", "ntopng.prefs.ldap.anonymous_bind", "0", nil, elementToSwitchBind, true, showElements)
@ -418,10 +419,10 @@ function printUsers()
print('<input style="display:none;" type="text" name="_" data-ays-ignore="true" />')
print('<input style="display:none;" type="password" name="__" data-ays-ignore="true" />')
--
prefsInputFieldPrefs("LDAP Bind DN", "Bind Distinguished Name of LDAP server. Example: \"CN=ntop_users,DC=ntop,DC=org,DC=local\".", "ntopng.prefs.ldap", "bind_dn", "", nil, showElementsBind, true, false)
prefsInputFieldPrefs("LDAP Bind DN", "Bind Distinguished Name of LDAP server. Example: \"CN=ntop_users,DC=ntop,DC=org,DC=local\".", "ntopng.prefs.ldap", "bind_dn", "", nil, showElementsBind, true, false, {style={width=PREFS_INPUT_WIDTH_MEDIUM}})
prefsInputFieldPrefs("LDAP Bind Authentication Password", "Bind password used for authenticating with the LDAP server.", "ntopng.prefs.ldap", "bind_pwd", "", "password", showElementsBind, true, false)
prefsInputFieldPrefs("LDAP Search Path", "Root path used to search the users.", "ntopng.prefs.ldap", "search_path", "", "text", showElements)
prefsInputFieldPrefs("LDAP Search Path", "Root path used to search the users.", "ntopng.prefs.ldap", "search_path", "", "text", showElements, nil, nil, {style={width=PREFS_INPUT_WIDTH_MEDIUM}})
prefsInputFieldPrefs("LDAP User Group", "Group name to which user has to belong in order to authenticate as unprivileged user.", "ntopng.prefs.ldap", "user_group", "", "text", showElements)
prefsInputFieldPrefs("LDAP Admin Group", "Group name to which user has to belong in order to authenticate as an administrator.", "ntopng.prefs.ldap", "admin_group", "", "text", showElements)