summaryrefslogtreecommitdiff
path: root/tex/context/base/util-sql-users.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/util-sql-users.lua')
-rw-r--r--tex/context/base/util-sql-users.lua21
1 files changed, 11 insertions, 10 deletions
diff --git a/tex/context/base/util-sql-users.lua b/tex/context/base/util-sql-users.lua
index f6845062f..4bf5057b5 100644
--- a/tex/context/base/util-sql-users.lua
+++ b/tex/context/base/util-sql-users.lua
@@ -208,13 +208,13 @@ local template =[[
`theme`,
`data`
) VALUES (
- '%name%',
+ '%[name]%',
'%password%',
'%group%',
'%enabled%',
- '%email%',
- '%address%',
- '%theme%',
+ '%[email]%',
+ '%[address]%',
+ '%[theme]%',
'%[data]%'
) ;
]]
@@ -305,8 +305,9 @@ local template =[[
`password` = '%password%',
`group` = '%group%',
`enabled` = '%enabled%',
- `email` = '%email%',
- `address` = '%address%',
+ `email` = '%[email]%',
+ `address` = '%[address]%',
+ `theme` = '%[theme]%',
`data` = '%[data]%'
WHERE
`id` = '%id%'
@@ -315,13 +316,15 @@ local template =[[
function users.save(db,id,specification)
- if not tonumber(id) then
+ id = tonumber(id)
+
+ if not id then
return
end
local user = getbyid(db,id)
- if user.id ~= id then
+ if tonumber(user.id) ~= id then
return
end
@@ -333,8 +336,6 @@ function users.save(db,id,specification)
local theme = specification.theme == nil and user.theme or specification.theme
local data = specification.data == nil and user.data or specification.data
--- table.print(data)
-
db.execute {
template = template,
variables = {