local password = json_string["password"] or "None"
local redisPassword = red:hmget(userName,"password") or None
local redisAuthtoken = red:hmget(userName,"authToken")
if (tostring(password) == tostring(redisPassword))
then
ngx.say(redisAuthtoken)
else
ngx.say("Error User or Service Not found 1510")
end
密码 = 管理员 redisPassword = 管理员
我能够将两个密码都视为输出管理员,但它在 lua 代码中不匹配,并且控制总是转到其他部分。
当我这样比较时
if (tostring(password) == "admin" )
它工作正常,这意味着问题出在 redis 值上,但我在 redis 中设置了密码值 admin。