libs/sys: fix luci.sys.checkpasswd() semantics

This commit is contained in:
Jo-Philipp Wich 2012-06-27 13:52:09 +00:00
parent d30109e350
commit b1617b3718

View file

@ -612,11 +612,10 @@ end
-- @return Boolean indicating wheather the passwords are equal
function user.checkpasswd(username, pass)
local pwh = user.getpasswd(username)
if pwh and nixio.crypt(pass, pwh) ~= pwh then
return false
else
return true
if pwh then
return (nixio.crypt(pass, pwh) == pwh)
end
return false
end
--- Change the password of given user.