summaryrefslogtreecommitdiffstats
path: root/kamailio-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'kamailio-model.lua')
-rw-r--r--kamailio-model.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/kamailio-model.lua b/kamailio-model.lua
index e730bc5..2f921de 100644
--- a/kamailio-model.lua
+++ b/kamailio-model.lua
@@ -233,10 +233,10 @@ end
function get_new_user()
local user = {}
- user.username = cfe({label="User Name"})
- user.password = cfe({label="Password"})
- user.password_confirm = cfe({label="Password (confirm)"})
- --user.email_address = cfe({label="E-mail Address"})
+ user.username = cfe({label="User Name", seq=1})
+ user.password = cfe({type="password", label="Password", seq=2})
+ user.password_confirm = cfe({type="password", label="Password (confirm)", seq=3})
+ --user.email_address = cfe({label="E-mail Address", seq=4})
return cfe({type="group", value=user, label="Kamailio User"})
end
@@ -281,6 +281,7 @@ function get_user(username)
local user = get_new_user()
user.value.username.value = username
user.value.username.errtxt = "Invalid user"
+ user.value.username.readonly = true
local users = list_users()
for i,u in ipairs(users.value) do
if u.username == username then
@@ -352,7 +353,7 @@ end
function get_table_entry(table, id)
local retval = {}
- retval.table = cfe({ value=table or "", label="Table", errtxt="Table does not exist", seq=0 })
+ retval.table = cfe({ value=table or "", label="Table", errtxt="Table does not exist", readonly=true, seq=0 })
local errtxt = "Table does not exist"
if table and table ~= "" then
local res, err = pcall(function()
@@ -370,13 +371,16 @@ function get_table_entry(table, id)
for i,f in ipairs(fields) do
retval[f] = cfe({ label=f, seq=i })
end
- if id and id ~= "" then
+ if id and id ~= "" and retval.id then
+ retval.id.readonly = true
local entry = getselectresponse("SELECT * FROM "..table.." WHERE id='"..escape(id).."'")
if entry and #entry > 0 then
for n,v in pairs(entry[1]) do
if retval[n] then retval[n].value = v end
end
end
+ elseif retval.id then
+ retval.id.type = "hidden"
end
end
if connected then databasedisconnect() end