diff --git a/src/dao/auth.lua b/src/dao/auth.lua index bc83446..9cec4d7 100644 --- a/src/dao/auth.lua +++ b/src/dao/auth.lua @@ -20,7 +20,7 @@ local function authenticate(name, passwd) if passwd == "" then return 0x010002, nil end - local pwdMd5 = ngx.encode_md5(passwd) + local pwdMd5 = ngx.md5(passwd) --根据用户进行验证用户是否存在 local code, res = userModel:where("username", "=", name):where("password", "=", pwdMd5):get() if code == 0 and res ~= nil then diff --git a/src/dao/user.lua b/src/dao/user.lua index 020bc7b..92322cb 100644 --- a/src/dao/user.lua +++ b/src/dao/user.lua @@ -73,7 +73,7 @@ function _M.addSystemUser(jsonData) jsonData.id = helpers.getUuid() --用户密码暂时使用md5进行加密 local pwd = jsonData['password'] - jsonData.password = ngx.encode_md5(pwd) + jsonData.password = ngx.md5(pwd) -- 创建一个用户 return userModel:create(jsonData) end