summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/util-sql-users.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/util-sql-users.lua')
-rw-r--r--tex/context/base/mkiv/util-sql-users.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/tex/context/base/mkiv/util-sql-users.lua b/tex/context/base/mkiv/util-sql-users.lua
index 7204fb310..57c99b2a7 100644
--- a/tex/context/base/mkiv/util-sql-users.lua
+++ b/tex/context/base/mkiv/util-sql-users.lua
@@ -25,12 +25,16 @@ local trace_sql = false trackers.register("sql.users.trace", function(v) trace_
local report = logs.reporter("sql","users")
local split = lpeg.splitat(":")
+
local valid = nil
local hash = function(s) return "MD5:" .. sumHEXA(s) end
+local sha2 = sha2 or (utilities and utilities.sha2)
-if LUAVERSION >= 5.3 then
+if not sha2 and LUAVERSION >= 5.3 then
+ sha2 = require("util-sha")
+end
- local sha2 = require("util-sha")
+if sha2 then
local HASH224 = sha2.HASH224
local HASH256 = sha2.HASH256
@@ -238,9 +242,7 @@ function users.valid(db,username,password,address)
name = username,
},
}
-
local data = data and data[1]
-
if not data then
return false, "unknown user"
elseif not data.enabled then